Skip to content

Commit 6311bed

Browse files
authored
Merge pull request #13939 from WilliamAntonRohm/issue-4221
sql-docs issue 4221 -- duplicated description of CATCH
2 parents 91d45e0 + cf1a301 commit 6311bed

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

docs/t-sql/language-elements/try-catch-transact-sql.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,14 @@ END CATCH
6464

6565
A TRY...CATCH construct cannot span multiple batches. A TRY...CATCH construct cannot span multiple blocks of [!INCLUDE[tsql](../../includes/tsql-md.md)] statements. For example, a TRY...CATCH construct cannot span two BEGIN...END blocks of [!INCLUDE[tsql](../../includes/tsql-md.md)] statements and cannot span an IF...ELSE construct.
6666

67-
If there are no errors in the code that is enclosed in a TRY block, when the last statement in the TRY block has finished running, control passes to the statement immediately after the associated END CATCH statement. If there is an error in the code that is enclosed in a TRY block, control passes to the first statement in the associated CATCH block. If the END CATCH statement is the last statement in a stored procedure or trigger, control is passed back to the statement that called the stored procedure or fired the trigger.
68-
69-
When the code in the CATCH block finishes, control passes to the statement immediately after the END CATCH statement. Errors trapped by a CATCH block are not returned to the calling application. If any part of the error information must be returned to the application, the code in the CATCH block must do so by using mechanisms such as SELECT result sets or the RAISERROR and PRINT statements.
67+
If there are no errors in the code that is enclosed in a TRY block, when the last statement in the TRY block has finished running, control passes to the statement immediately after the associated END CATCH statement.
68+
69+
If there is an error in the code that is enclosed in a TRY block, control passes to the first statement in the associated CATCH block. When the code in the CATCH block finishes, control passes to the statement immediately after the END CATCH statement.
70+
71+
> [!NOTE]
72+
> If the END CATCH statement is the last statement in a stored procedure or trigger, control is passed back to the statement that called the stored procedure or fired the trigger.
73+
74+
Errors trapped by a CATCH block are not returned to the calling application. If any part of the error information must be returned to the application, the code in the CATCH block must do so by using mechanisms such as SELECT result sets or the RAISERROR and PRINT statements.
7075

7176
TRY...CATCH constructs can be nested. Either a TRY block or a CATCH block can contain nested TRY...CATCH constructs. For example, a CATCH block can contain an embedded TRY...CATCH construct to handle errors encountered by the CATCH code.
7277

0 commit comments

Comments
 (0)