Hi
In a stored procedure i want to check a condition through query if it is false only then the remaining part of S.P should gets executed.
Thanks
Hi
In a stored procedure i want to check a condition through query if it is false only then the remaining part of S.P should gets executed.
Thanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaimin ShethiyaRank #177 · 13.7K reputationPosted Dec 9, 2024, 5:27 AM EST
Hello,
You can use simply if statement as below mentioned.
If (Condition) Begin ...... ...... EndIf you want to use if else statement then you can use below example.
If (Condition) Begin .... .... End Else Begin .... .... EndThanks
Vijay Pratap SinghRank #381 · 6.6K reputationPosted Dec 9, 2024, 5:13 AM EST
Hi
You can achieve this by using an 'IF' statement in your stored procedure to check the condition and decide whether to proceed with the rest of the procedure.
For more info please visit below article
https://www.c-sharpcorner.com/UploadFile/rohatash/if-and-while-statement-in-sql-server-2012/
https://www.c-sharpcorner.com/UploadFile/65fc13/conditional-statements-in-mysql/
Thanks