Kentgi Tomo Kentgi Tomo - 17 days ago 5
SQL Question

i can't use IF selection with 2 condition

how can I fix this?

my code:

if (exists (select OperationDocumentReportExamCode from OperationDocumentReportExam where OperationDocumentReportExamCode = @CODE) AND @OVERRIDE IS '0')
Begin
Select 0 as Result
End

Answer
IF @OVERRIDE = 0 AND EXISTS (SELECT 1 FROM OperationDocumentReportExam WHERE OperationDocumentReportExamCode = @CODE)

BEGIN
SELECT 0 [Result]
END