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 关键字'SET'附近的语法错误。 消息156,级别15,状态1,过程SP_CheckDB,36 行中的关键字 'ELSE'Case Statement Set参数
本声明请帮助
感谢
'CASE'是*表达* - 它产生的a *值*。它不是*控制流量表。 –