Is There a better way I could have written the following stored procedure?
Or is my way cool?
Checking: Username, Password, Activation = True
CREATE PROCEDURE GetAuthorization
(
@Username Varchar( 20 ),
@Password Varchar( 16 )
)
AS
DECLARE @AccountID INT
SELECT @AccountID = AccountID
FROM Account
WHERE Username = @username
AND Password = @Password AND Active = 1
IF @AccountID IS NOT NULL
Return @AccountID
ELSE
IF Exists( SELECT Username
FROM Account WHERE Username = @Username)
Return - 3
ELSE
IF Exists( SELECT Username
FROM Account WHERE Username = @Username AND Password = @Password AND
Active = 0 )
Return - 2
ELSE
RETURN - 1
GO