How to use Try catch in sql server and print the error message

BEGIN TRY
 
DELETE FROM tablesamaple where strsampletodelete = 'todelete'
 
END TRY
BEGIN CATCH
Print ERROR_MESSAGE()
END CATCH
Ebook Download
View all
SQL Jobs
Read by 0 people
Download Now!
Learn
View all