Hey guys I've got the following code drawn up. But it doesnt work has I wanted it to and can't figure out why.
If the user doesn't exist or if that username has been disabled then the query should return -1 otherwise it returns 0. Now that doesn't happen. It doesn't return -1 at any point, it always returns 0. Can anyone point me in a direction has to why this is happening? Thanks
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[checkLogin]
-- Add the parameters for the stored procedure here
@login nvarchar(255),
@password nvarchar(255)
AS
BEGIN
SET NOCOUNT ON;
select isnull(nullif(member_deleted,1),-1)
from Table2 t2
join Table1 t1
on t1.member_id=t2.member_id
where t1.User_login = @login
and t1.User_pwd = @password
and EXISTS(SELECT 1 FROM User)
END
Acid