I wrote a stored procedure which returns contract status for anauthor. If author doesn't exist i'll return -900. So, this is what i did
CREATE PROCEDURE AUthorContract
@user varchar(10)
AS
IF(@user NOT IN(select Au_id from Authors))
BEGIn
RETURN -900
END
ELSE
BEGIN
select contract from from Authors where Au_id = @user
END
GO
However, when I give a valid author id as input, it returns -900 and if i give some id it goes into else and just returns 0 . So, I reversed them and entered correct id, but it still just returns 0 and not the contract value. Can u please help me out the mistake i have been doing. The DB is pubs.