OUTPUT updated records into a FOR XML statement

North

New Member
Is it possible to update a table and return the updated values in a FOR XML statement?
Consider the following table of customers: \[code\]Customers Id FirstNam LastNam 1 John Doe 2 James Smith 3 Martin Jones \[/code\]I'd like to update the FirstNam of the customer with Id 2 to David, and return the result as XML.
I've tried using: \[code\]UPDATE Customers SET FirstNam = 'David'WHERE Id = 2OUTPUT inserted.FirstNamFOR XML PATH('')\[/code\]which, of course, doesn't work. What am I doing wrong? As always, any help is greatly appreciated!
 
Back
Top