Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

tsql try catch

BEGIN TRY  
     { sql_statement | statement_block }  
END TRY  
BEGIN CATCH  
     [ { sql_statement | statement_block } ]  
END CATCH  
[ ; ]

-- ex:
BEGIN TRANSACTION
BEGIN TRY

UPDATE users SET id = 0

END TRY
BEGIN CATCH

ROLLBACK

END CATCH

COMMIT
Source by learn.microsoft.com #
 
PREVIOUS NEXT
Tagged: #tsql #catch
ADD COMMENT
Topic
Name
2+9 =