sandeep1188
Old Hand
Points: 389
More actions
May 20, 2011 at 6:18 pm
#251332
I HAVE TO DELETE FEW RECORDS FROM A TABLE BASED ON SOME CONDITIONS AND INSERT THE SAME DELETED RECORDS INTO A TEMP TABLE.Please help me in this.
Thanks,
Sandeep
Welsh Corgi
SSC Guru
Points: 116520
May 20, 2011 at 6:23 pm
#1328048
sandeep1188 (5/20/2011)I HAVE TO DELETE FEW RECORDS FROM A TABLE BASED ON SOME CONDITIONS AND INSERT THE SAME DELETED RECORDS INTO A TEMP TABLE.Please help me in this.
sandeep1188 (5/20/2011)
I would insert the records into the temp table and then delete the record from the table by joining on the temp table and include in a transaction.
For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Orlando Colamatteo
Points: 182279
May 20, 2011 at 7:35 pm
#1328055
You can do it one statement using the OUTPUT clause. See Example F in this article: http://msdn.microsoft.com/en-us/library/ms177564.aspx
There are no special teachers of virtue, because virtue is taught by the whole community.--Plato
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply