# SQL Server Rule: SRD0013
| | |
|----|----|
| Assembly | SqlServer.Rules |
| Namespace | SqlServer.Rules.Design |
| Class | WrapStatementsWithTryCatchRule |
## Rule Information
| | |
|----|----|
| Id | SRD0013 |
| Friendly Name | Expected error handeling |
| Category | Design |
| Ignorable | false |
| Applicable Types | Procedure |
## Description
Wrap multiple action statements within a try catch.
## Summary
Wrap TRY..CATCH around multiple data manipulation statements.
### Examples
```sql
CREATE PROCEDURE dbo.InsertMissingColumnSpecifiers
AS
SET NOCOUNT ON;
INSERT INTO dbo.TestTableSSDT
SELECT [IdCol],Col1,Col2,Col3,DateCol FROM dbo.TestTableSSDT;
INSERT INTO dbo.TestTableSSDT([IdCol],Col1,Col2,Col3,DateCol)
SELECT [IdCol],Col1,Col2,Col3,DateCol FROM dbo.TestTableSSDT;
-- SML012, SRD0009, SRD0013
```
### Remarks
The rule checks for SELECT INTO,INSERT,DELETE and UPDATE statements which are neither
inside <c>TRY..CATCH</c> block. This check is important, because, by default, SQL Server
will not rollback all the previous changes within a transaction if a particular statement
fails and setting <c>XACT_ABORT</c> is not ON.
<sub><sup>Generated by a tool</sup></sub>