我该如何解决这个问题?
我的代码:
if (exists (select OperationDocumentReportExamCode from OperationDocumentReportExam where OperationDocumentReportExamCode = @CODE) AND @OVERRIDE IS '0')
Begin
Select 0 as Result
End
答案 0 :(得分:4)
IF (@OVERRIDE = 0
AND EXISTS (SELECT 1
FROM operationdocumentreportexam
WHERE operationdocumentreportexamcode = @CODE))
BEGIN
SELECT 0 [Result]
END
答案 1 :(得分:2)
IF EXISTS
( SELECT 1 FROM OperationDocumentReportExam
WHERE OperationDocumentReportExamCode = @CODE
) AND @OVERRIDE = 0
Begin
SELECT 0 AS Result
End
答案 2 :(得分:2)
稍微修改了一下您的查询:
if exists (select OperationDocumentReportExamCode from OperationDocumentReportExam where OperationDocumentReportExamCode = @CODE) AND @OVERRIDE = '0'
Begin
Select 0 as Result
End