SET on SET TRANSACTION Isolation Level READ Uncommitted SET on BEGIN TRY END TRY BEGIN CATCH END
1.SET NOCOUNT on
When SET NOCOUNT is on, no count is returned (indicating the number of rows affected by the Transact-SQL statement). When SET NOCOUNT is OFF, the count is returned.
2.SET TRANSACTION Isolation Level READ syntax there are four scenarios
First case:
READ COMMITTED
The function of this sentence is:
Specifies that shared locks are controlled when data is read to avoid dirty reads, but the data can be changed before the transaction ends, resulting in non-repeatable reads or phantom data. This option is the default value for SQL Server.
Second case:
READ Uncommitted
The function of this sentence is:
Performs a dirty read or level 0 isolation lock, which means that no shared lock is issued and an exclusive lock is not accepted. When you set this option, you can perform uncommitted read or dirty reads on the data, and you can change the values within the data before the transaction ends, and the rows can appear in the dataset or disappear from the dataset. This option works the same as setting NOLOCK on all the tables in all statements within a transaction. This is the least restrictive level in the four isolation levels.
The third case:
Repeatable READ
The function of this sentence is:
Locks all data used in the query to prevent other users from updating the data, but other users can insert new Phantom rows into the dataset, and phantom rows are included in subsequent reads of the current transaction. Because concurrency is lower than the default isolation level, you should use this option only when necessary.
Fourth case:
SERIALIZABLE
The function of this sentence is:
Place a range lock on the dataset to prevent other users from updating the dataset or inserting rows into the dataset before the transaction completes. This is the most restrictive level in the four isolation levels. Because the concurrency level is low, you should use this option only when necessary. This option works the same as setting HOLDLOCK on all tables in all SELECT statements within a transaction .
3.SET Xact_abort on
Transaction rollback
SQL Stored Procedure Notes