Introduces a set of Transact-SQL statements that you can use to handle errors in a Transact-SQL code block.
TRY
-- T-SQL statements to monitor for errors.
-- Statements that can potentially cause an error.
-- For example, operations that might violate constraints,
-- cause division by zero, or reference non-existent objects.
...
CATCH
-- T-SQL statements to execute if an error occurs in the TRY block.
-- This block contains error handling logic.
-- You can log the error, notify administrators, or attempt recovery.
...
END TRY
[
CONSTRAINT constraint_name