Here is my SQL query
Declare @Type varchar
select
if
(tn.notification_type=1)
begin
set @Type= 'WORK FLOW'
print 'status '+ CAST(@type AS nvarchar(58))
end
from tbl_Notification tn
here I am getting problem to include a condition based on a table column value
E.g. I have values 1 and 2 and 3
when I execute I am getting the error.
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword ‘if’.
Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword ‘from’.
To elaborate on Namphibian’s answer, which is accurate:
You also won’t be able to do the print in the SQL query like that, you’d have to do it afterwards or in some sort of looping situation.