我的存储过程返回以下内容:
DECLARE @AnswerGridCorrect VARCHAR(20)
...
...
SELECT @AnswerGridResponses AS AnswerGridResponses,
@AnswerGridCorrect AS AnswerGridCorrect,
@Authenticated As Authenticated,
@RC AS RC,
@Result AS Result
如果NULL
,如何让@AnswerGridCorrect
为@Result = 'F'
?
答案 0 :(得分:1)
您可以使用switch case语句执行此操作。
DECLARE @AnswerGridCorrect VARCHAR(20)
...
...
SELECT @AnswerGridResponses AS AnswerGridResponses,
CASE @Result
WHEN 'F' THEN null
ELSE @AnswerGridCorrect
END AS AnswerGridCorrect,
@Authenticated As Authenticated,
@RC AS RC,
@Result AS Result