Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hello, every one i need to insert deleted data in two different table.Is this possible to do it in a single query for ex.Delete A OUTPUT deleted.col1, deleted.col2INTO t1(col1,col2)FROM tab1where col1 like '%aaa%'but i want to use it likeDelete A OUTPUT deleted.col1, deleted.col2INTO t1(col1,col2)OUTPUT deleted.col1, 'd'INTO t2(col1,col2)FROM tab1where col1 like '%aaa%'Is this possible ??Please suggest me so that i can accomodate the code in my existing query other wise i will have to insert it seperatelyVaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER
RickD
Slow But Sure Yak Herding Master
3608 Posts
Posted - 2010-06-15 : 07:39:55
No, insert it into a table variable and then into each table.
SwePeso
Patron Saint of Lost Yaks
30421 Posts
Posted - 2010-06-15 : 10:01:34
Or create a trigger which can do it transparently for you
Thank you very much for your replies.I have been used RickD's Solution Peso: in our database we are not allowed to use triggers on tables.I dont know the reason why do not use this rich feature of SQL Server.Might be our database is so much bulky thats why....Vaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER