Check dublicate username(sql2005)
CREATE PROCEDURE UspCheckForDuplicates
(
@UserName VARCHAR(50) = NULL,
@FirstName VARCHAR(50) = NULL,
@LastName VARCHAR(50) = NULL,
@Duplicates INT = 0
)
AS
SET @Duplicates =(SELECT COUNT(*) FROM NorthWindUsers
WHERE UserName = @UserName
OR FirstName = @FirstName AND LastName = @LastName)
RETURN @Duplicates
No comments:
Post a Comment