Hello,
I have the following code that doesn't work. What I want to do is based on some variable I have to check if all bit fields of that variable are true. If yes, return true else return false.
Any suggestions?
DECLARE @var NVARCHAR(20);
IF EXISTS (SELECT variable FROM Table1 WHERE IDNO=@IDNO)
BEGIN
SELECT @var=variable FROM Table1 WHERE IDNO=@IDNO
SELECT CASE @var
WHEN 1 THEN
IF EXISTS(SELECT CheckFlag FROM Table2 INNER JOIN Table1 ON Table2.IDNO=Table1.IDNO WHERE [Check1]=1 and [Check2]=1 and [Check3]=1 and Table1.IDNO=@IDNO)
RETURN 1
ELSE
RETURN 0
WHEN 2 THEN
......
ELSE -1
END
Thank you in advance.