My Code:
'Status' =
CASE
WHEN @ID = 2 AND Stud.Status = 'N' THEN 'To Be Submitted'
WHEN Stud.Status = 'N' THEN 'N/A'
ELSE ISNULL(Stud.Status, '')
END
I want to add an Insert
statement if the first condition is satisfied, That is, after the following code. How to add an Insert
statement here.
WHEN @ID = 2 AND Stud.Status = 'N' THEN 'To Be Submitted'
Thanks.
I would make your query into a Store Procedure, add your first query to a temp table and then split it into what you need... for example:
and then use that temp table to perform your insert
This way you are only inserting what you need as
TOP 1
will make sure of that