Sample Header Ad - 728x90

Can the OUTPUT clause create a table?

8 votes
3 answers
7035 views
I'm doing an update like this: UPDATE dbo.Table1 SET BirthDate = b.BirthDate FROM Table1 a JOIN Table2 b ON a.ID = b.ID And I want to use the OUTPUT clause to back up my changes. UPDATE dbo.Table1 SET BirthDate = b.BirthDate OUTPUT inserted.Id, inserted.BirthDate AS New_BirthDate, deleted.BirthDate AS Old_BirthDate INTO OutputTable FROM Table1 a JOIN Table2 b ON a.ID = b.ID What I want to know is if there is a way for the OUTPUT clause to create the table OutputTable or do I have to make sure it already exists before running the statement?
Asked by Kenneth Fisher (24317 rep)
Mar 22, 2013, 06:28 PM
Last activity: May 2, 2016, 08:24 PM