By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,364 Members | 1,341 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,364 IT Pros & Developers. It's quick & easy.

delete output into <xml column of audit table>

P: n/a
cc
Currently running Sql Server 2005

Is it possible to issue the delete command and capture the affected rows as
xml types that will be stored in an audit table with an xml column?

Something along the lines of:

delete from source_table
output
(deleted.*
into audit_table (xml_audit_column)
for xml auto)
where source_table.column = @delete_value


Mar 31 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You cannot do it in a single statement because the OUTPUT clause does not
support subqueries. One way is to get the deleted rows into a temp table and
then transfer as XML to your audit table.

Here is one example of implementing this in a trigger:
http://blogs.sqlservercentral.com/pr...-with-xml.aspx

HTH,

Plamen Ratchev
http://www.SQLStudio.com

Mar 31 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.