Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Error Handling in Stored Procedure code

$
0
0

Hi All,

I need to know which step is failing and whats the error message when i run a stored procedure.

Lets say i have a stored procedure with below content.So i want to know which of the below four statements failed,and

the error message belonging to it.

How can i modify the below code to achieve my output.

begin try

DELETE FROM Table1 WHERE Column1 = 'A'
UPDATE Table1 SET Column1 = 'C' WHERE Column2 = 'B'
SELECT * FROM Table1 WHERE Column3 = 'C'
SELECT * FROM Table1 WHERE Column4 = 'D'

end try

begin catch
end catch

Thanks in Advance!!

Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>