I'm trying to build a Stored Procedure for returning user data on login. I want the SP to
Check if Username exists - if not return code 1
Check if username and password match - if not code 2
if both match - return code 3, userid and the encrypted password.
My SP looks wrong,..(if getting an underline on the first comma of row 25) and in MS SQL 2008 what column type is needed for encrpted passwords?
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
ALTER PROCEDURE [dbo].[JobsterCandidateLogin]
SET NOCOUNT ON;
/*Declare additional variables */
DECLARE @Result int
DECLARE @UserID int
DECLARE @UserAuth NVARCHAR(225)
IF NOT EXISTS (SELECT ID from dbo.Candidate where Username = @Username)
SET @Result = '1'
ELSE IF NOT EXISTS (SELECT ID from dbo.Candidate where Username = @Username AND [Password] = @Password)
SET @Result = '2'
SET @Result = '3', @UserID = ID, @UserAuth = [Password], from dbo.Candidate where Username = @Username AND [Password] = @Password
Select @Result as Result, @UserID as UserID, @UserAuth as UserAuth
Grateful for any help.