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 |
|
mageshks
Yak Posting Veteran
59 Posts |
Posted - 2007-01-30 : 11:08:48
|
| Will raiserror within a procedure make a auto rollbackI have a SP likeCreate procedure testasbegin traninsert into test values (1,'one')raiseerror('%s',16,1,'Value Inserted')commit tranwill the above SP make the insertion or not?.if not,pls tell me how to make the value insert into the table stillraiserror is needed.Thanks in advance |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2007-01-30 : 11:16:44
|
| Yes it will do the insert as you have committed the transaction.begin traninsert into test values (1,'one')raiseerror('%s',16,1,'Value Inserted')rollback tranNote - for a singel statement you don't need a transaction as every statement is atomic. If it fails it will rollback and raise an error for you.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-01-30 : 11:17:06
|
| Severity level above 18 will cause auto rollback.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|