I'm trying to get the result of an executed stored procedure to be retrieved as a XML of the table the result is shown as originally.
What I'm trying to do is somthing like this.
exec dbo.StoredProcedure FOR XML RAW, ROOT ('root_name').
Lets say exec dbo.StoredProcedure
returns the table in the Stored Procedure,
I want the FOR XML RAW, ROOT ('root_name')
to return the XML value of that whole result.
How do I achieve this In SQL server?
One method is to insert the proc results into a temp table or variable using
INSERT...EXEC
and then select from that table with the desiredFOR XML
query: