CREATE PROCEDURE [dbo].[Proc_User_IsDuplicate]
@UserID AS INT,
@LoginID AS VARCHAR(100)
AS
BEGIN
IF @UserID > 0
BEGIN
IF (SELECT COUNT(*) FROM [User] WHERE
LoginID = @LoginID AND
UserID <> @UserID ) > 0
SELECT 1
IsDuplicate
ELSE
SELECT 0
IsDuplicate
END
ELSE
BEGIN
IF (SELECT COUNT(*) FROM [User] WHERE
LoginID = @LoginID AND IsActive =1) > 0
SELECT 1
IsDuplicate
ELSE
SELECT 0
IsDuplicate
END
END
No comments:
Post a Comment