Click here to Skip to main content
15,896,269 members
Home / Discussions / Database
   

Database

 
GeneralRe: Must Declare Scalar variable Pin
Roger Wright20-Jan-11 10:44
professionalRoger Wright20-Jan-11 10:44 
GeneralRe: Must Declare Scalar variable Pin
Hiren solanki20-Jan-11 18:28
Hiren solanki20-Jan-11 18:28 
GeneralRe: Must Declare Scalar variable Pin
Ali Al Omairi(Abu AlHassan)21-Jan-11 7:18
professionalAli Al Omairi(Abu AlHassan)21-Jan-11 7:18 
QuestionLittle help needed with a Stored Proc Pin
Aptiva Dave19-Jan-11 6:57
Aptiva Dave19-Jan-11 6:57 
AnswerRe: Little help needed with a Stored Proc Pin
Eddy Vluggen19-Jan-11 7:17
professionalEddy Vluggen19-Jan-11 7:17 
AnswerRe: Little help needed with a Stored Proc Pin
Corporal Agarn19-Jan-11 7:23
professionalCorporal Agarn19-Jan-11 7:23 
AnswerRe: Little help needed with a Stored Proc Pin
Aptiva Dave19-Jan-11 7:47
Aptiva Dave19-Jan-11 7:47 
AnswerRe: Little help needed with a Stored Proc Pin
Martin Arapovic19-Jan-11 7:48
Martin Arapovic19-Jan-11 7:48 
I think this is what you need.
Just fill the blanks....
<code>
-- =============================================
-- Author:		Martin Arapovic
-- Create date: 19.01.2011
-- Description:	....
-- =============================================
CREATE PROCEDURE InsertUserData 
	(
		-- Add the parameters for the stored procedure here
		-- Define needed parameters
		-- Contact Input Data
		@Street VARCHAR(50), 
		@City VARCHAR(50), 
		@State VARCHAR(50), 
		@EmailAddress VARCHAR(50),
		--Users Input Data
		@UserName VARCHAR(25), 
		@Password VARCHAR(25),
		-- User Input Data
		@FirstName varchar(50),
		@LastName varchar(50),
		@Sex varchar(50)
		-- Add other paramas if you have any
	)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	DECLARE @ContactID INT 
	DECLARE @AuthenticationID INT 
	
	--
	-- Note: This is only skeleton of the proc that you want to implement
	
	--
	-- Do all in one transaction
	
	BEGIN TRANSACTION
	
	--
    -- Insert Contact data and get ContactID
    INSERT INTO [Contact]
           ([Street]
           ,[City]
           ,[State]
           ,[EmailAddress])
     VALUES
           (@Street
           ,@City
           ,@State
           ,@EmailAddress)
           
    -- GET CointactID 
    SET @ContactID = SCOPE_IDENTITY() 
     
    --
    -- Insert Authentication data and get AuthenticationID
    INSERT INTO [Authentication]
           ([UserName]
           ,[Password])
     VALUES
           (@UserName
           ,@Password)
           
    -- GET Authentication 
    SET @AuthenticationID = SCOPE_IDENTITY() 
     
    -- 
    -- Insert Users data into users table.
    INSERT INTO [Users]
           ([FirstName]
           ,[LastName]
           ,[Sex]
           ,[AuthenticationID]
           ,[ContactID])
     VALUES
           (@FirstName
           ,@LastName
           ,@Sex
           ,@AuthenticationID
           ,@ContactID)

     -- Commit
     COMMIT TRANSACTION
     
     -- This is the general example and you need to add error handling and 
     -- other bussines logic if you have any... :)
           	
END
GO
</code>

QuestionCompare table data on two different databases Pin
vanikanc19-Jan-11 5:49
vanikanc19-Jan-11 5:49 
AnswerRe: Compare table data on two different databases Pin
Chris Meech19-Jan-11 6:01
Chris Meech19-Jan-11 6:01 
GeneralRe: Compare table data on two different databases Pin
Corporal Agarn19-Jan-11 6:04
professionalCorporal Agarn19-Jan-11 6:04 
GeneralRe: Compare table data on two different databases Pin
Chris Meech19-Jan-11 6:41
Chris Meech19-Jan-11 6:41 
AnswerRe: Compare table data on two different databases Pin
Corporal Agarn19-Jan-11 6:05
professionalCorporal Agarn19-Jan-11 6:05 
GeneralRe: Compare table data on two different databases Pin
vanikanc19-Jan-11 6:59
vanikanc19-Jan-11 6:59 
AnswerRe: Compare table data on two different databases Pin
Corporal Agarn19-Jan-11 7:18
professionalCorporal Agarn19-Jan-11 7:18 
AnswerRe: Compare table data on two different databases Pin
Eddy Vluggen19-Jan-11 7:20
professionalEddy Vluggen19-Jan-11 7:20 
Questionbcp command Pin
vanikanc19-Jan-11 3:22
vanikanc19-Jan-11 3:22 
AnswerRe: bcp command Pin
Pravin Patil, Mumbai19-Jan-11 3:58
Pravin Patil, Mumbai19-Jan-11 3:58 
QuestionWhen to NOT normalize? Pin
Sander Rossel18-Jan-11 10:48
professionalSander Rossel18-Jan-11 10:48 
AnswerRe: When to NOT normalize? PinPopular
dasblinkenlight18-Jan-11 12:03
dasblinkenlight18-Jan-11 12:03 
AnswerRe: When to NOT normalize? PinPopular
Mycroft Holmes18-Jan-11 13:46
professionalMycroft Holmes18-Jan-11 13:46 
AnswerRe: When to NOT normalize? Pin
Yusuf18-Jan-11 14:15
Yusuf18-Jan-11 14:15 
AnswerRe: When to NOT normalize? Pin
PIEBALDconsult18-Jan-11 18:39
mvePIEBALDconsult18-Jan-11 18:39 
GeneralRe: When to NOT normalize? Pin
Sander Rossel19-Jan-11 4:28
professionalSander Rossel19-Jan-11 4:28 
GeneralRe: When to NOT normalize? Pin
PIEBALDconsult19-Jan-11 17:49
mvePIEBALDconsult19-Jan-11 17:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.