How to handle error in sqlserver (functions)
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
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
Sukesh MarlaRank #461 · 5.4K reputationPosted Sep 18, 2012, 1:46 AM EDT
You can use Try Catch block as
BEGIN TRY
// SQL Statements
END TRY
BEGIN CATCH
Select ERROR_NUMBER() ,
ERROR_STATE() ,
ERROR_SEVERITY() ,
ERROR_LINE() ,
ERROR_PROCEDURE() ,
ERROR_MESSAGE()
END CATCH
Check this is correct answer if it helped