Listing 10-73. CreateUser Stored Procedure

USE [GroupBrush]GOCREATE Procedure [dbo].[CreateUser](@Name nchar(100),@Password nchar(255),@UserId int output)AsBeginDeclare @ReturnValue int = -1If Exists(Select 1 From dbo.Users Where Name = @Name)Begin        Set @ReturnValue = 1EndElseBegin        Declare @UserIds Table (userId int)        INSERT INTO [dbo].[Users]                           ([Name]                           ,[Password])                Output Inserted.UserId Into @UserIds(userId)                 VALUES                           (@Name                           ,@Password)        Select @ReturnValue = 0, @UserId = userId From @UserIdsEndReturn @ReturnValueEndGO

Listing 10-74. ValidateUser Stored Procedure

USE [GroupBrush]GOCREATE ...

Get Pro ASP.NET SignalR: Real-Time Communication in .NET with SignalR 2.1 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.