SQL Server 2012: how to display the @Var
result inside a Case
statement with literals before and after the @Var
?
A simple query:
Declare @Var1 ...
Declare @Var2....
Select ....
CASE
WHEN ...........
THEN 'Display this sentence ' + @Var1 +'followed by there words'
ELSE 'Display these other words ' +@Var2 'followed by these other words'
END
The error message is
'Display this sentence' is not a declared variable.
I know it isn't! It should be a literal statement, only with the @Var1
result inside the literal statement.
What am I missing?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…