SELECT (CASE
WHEN(percentage >= @Start AND percentage < @End)
THEN
SET @body ='<html><body><H3>Report</H3>
<table border = 1>
<tr>
<th>No </th> <th> date </th> <th> lag </th> <th> Variance </th></tr>'
SET @body = @body + @xml +'</table></body></html>'
ELSE 'NULL' END) as Variance
FROM TestTbl
Msg 156, Level 15, State 1, Procedure SP_CheckDB, Line 31
Incorrect syntax near the keyword ‘SET’.
Msg 156, Level 15, State 1, Procedure SP_CheckDB, Line 36
Incorrect syntax near the keyword ‘ELSE’
Kindly help with this statement
Thanks
Use this
OR