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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SQL Server Update and insert together

Author  Topic 

tech_1
Posting Yak Master

129 Posts

Posted - 2010-10-25 : 11:45:56
when updating rows in a query, is there also a way that for each row that is being updated, to insert a record into another table containing say a field (an FK ID) to use for the insertion?

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-10-25 : 12:33:03
Have a look of Output operator.
Go to Top of Page

tech_1
Posting Yak Master

129 Posts

Posted - 2010-10-26 : 00:43:07
sorry? can you explain much more information than that? I dont think an output parameter/operator will help here.
Go to Top of Page

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-10-26 : 01:36:14
Have a look at:

http://weblogs.sqlteam.com/peterl/archive/2007/10/03/New-OUTPUT-operator.aspx

http://blog.sqlauthority.com/2007/10/01/sql-server-2005-output-clause-example-and-explanation-with-insert-update-delete/

If still you feel that output cannot be used the please post the ddl, sample data and expected output for us to analyze your requirement.
Go to Top of Page
   

- Advertisement -