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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 deletion and insertion

Author  Topic 

subhaoviya
Posting Yak Master

135 Posts

Posted - 2012-09-07 : 09:57:42

Is it possible to delete the records from source table after getting insertted in to destination table in single query?

with the help of outputclause or merge or...

thanks
subha

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-09-07 : 10:00:06
If you are on SQL 2005 or later, you can use the output clause as you have indicated. There is a pretty good article with examples here: http://www.simple-talk.com/sql/learn-sql-server/implementing-the-output-clause-in-sql-server-2008/
Go to Top of Page

subhaoviya
Posting Yak Master

135 Posts

Posted - 2012-09-07 : 11:22:21

Really fentastic article.
thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-09-08 : 17:14:57
http://weblogs.sqlteam.com/peterl/archive/2009/04/08/Composable-DML.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -