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 |
|
allan8964
Posting Yak Master
249 Posts |
Posted - 2012-03-06 : 17:37:54
|
| hi there,For following statement:insert into table(status) values('done')I need to check @code. If @code=3 then I won't run the insert.If I put the codes in a stored procedure, can I use Commit Tran and Rollback Tran for this? If yes, how? Thanks in advance. |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2012-03-06 : 17:44:55
|
| What is @code? Is that a parameter to a stored procedure? If so, you can use an IF..ELSE control-flow construct to conditionally execute T-SQL statements.And, based on the information provided, you would NOT use a transaction/rollback to conditionally insert data. |
 |
|
|
|
|
|