Revision: 48269
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at June 28, 2011 01:21 by wedgardigitalwkscom
Initial Code
SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE TestApp_UserCreate @Name NVARCHAR(128), @DateOfBirth DATE, @IdentityCard NVARCHAR(64) = NULL, @Nickname NVARCHAR(128) = NULL, @Email NVARCHAR(128), @Gender BIT, @MaritalStatusID SMALLINT = NULL, @NumberOfChildren SMALLINT = NULL, @UserID INT OUTPUT AS BEGIN BEGIN TRANSACTION INSERT INTO Users(Name, DateOfBirth, IdentityCard, Nickname, Email, Gender, MaritalStatusID, NumberOfChildren, CreateDate) VALUES(@Name, @DateOfBirth, @IdentityCard, @Nickname, @Email, @Gender, @MaritalStatusID, @NumberOfChildren, GETDATE()) IF(@@ERROR <> 0) BEGIN ROLLBACK TRANSACTION END ELSE BEGIN SELECT TOP 1 @UserID = UserID FROM Users ORDER BY CreateDate DESC COMMIT TRANSACTION END END GO
Initial URL
http://www.digitalwks.com/blogs/wilson-edgar/2011/06/27/stored-procedures-multiples-resulset-and-table-value-parameters
Initial Description
Initial Title
Create New User
Initial Tags
Initial Language
SQL