Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
chih
Posting Yak Master
154 Posts |
Posted - 2009-02-09 : 00:32:44
|
| Hi All,Is the good practise to have error handling (Try & Catch) in Stored Procedure?I often see statement -(begin transaction and commit transaction) in our Stored Procedure. for exampleBegin Transaction update member set status=1 where user='dd' insert customer values (30,'f')Commit TransactionWill the Stored Procedure rollback (update and insert) by itself if there is an error occur in the transaction e.g error in inserting?or it will only rollback if I apply Try & Catch and specify rollback transaction in catch?any article can you recommend?Thanks in advance |
|
|
Jai Krishna
Constraint Violating Yak Guru
333 Posts |
Posted - 2009-02-09 : 00:50:50
|
| it roll backs when an error occurs if u use Try & Catch and specify rollback transaction in catchJai Krishna |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-02-09 : 03:33:53
|
| also see thishttp://www.sommarskog.se/error-handling-I.html |
 |
|
|
|
|
|