|
Is there a better way to do this? t1 is a table on the database and t2 is a temp table.
(comments are locked)
|
|
You could wrap both statements in a single transaction How do you want to make it 'better'? Atomic? Consistent? Isolated? Durable? Hmm... sounds like a transaction...... Thanks Kev! Guess wrapping them in a transaction is what I'll do.
Jun 08 '11 at 09:18 AM
Shivu
(comments are locked)
|
|
Kev is right, you can wrap them in a transaction in order to make them part of a single unit, but no matter what, you're going to modify one table and then the other. There is no way to completely achieve a perfectly parallel operation from within a query. You must have individual UPDATE/INSERT/DELETE statements for each table. Would the OUTPUT clause help in the situation you're experiencing?
(comments are locked)
|
|
I only add to @Kev. When you will wrap two update statements into a transaction, take care about the Tale a look on MSDN for SET XACT_ABORT setting and a nice example provided there.
(comments are locked)
|

