May 9, 2012 at 4:35 am
hi folks
this is proboably a really simple problem, but i just can't see the wood for the trees here.
i have a result set with a single column that is the result of a very simple query - what i need to do is package these up as XML into a variable
here's some sample code to show what i want to do (it's not my production code - this is just prototyping so that i can show the issue)
declare @results xml
select @results=name from sysobjects for XML AUTO
i get the error
"the FOR XML clause is not allowed in an assignment statement"
this must be soooooo simple, i can't seem to figure out a way to do this
hang my head in shame
MVDBA
May 9, 2012 at 4:42 am
does this help
declare @results xml
set @results = (select name from sysobjects for XML AUTO)
select @results
May 9, 2012 at 4:46 am
genius - thank you
MVDBA
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy