Hi,
I would like to generate an XML query using the 'for xml' clause and assign
that to a text variable for further manipulation.
for e.g., I would like to do some thing like this.
declare @.test text
Set @.test = Select * from test_table for xml auto
But this gives my the syntax error. Can anyone help capturing the xml output
of a query into a variable?
Regards,
ArunHi
Have you looked at the text datatype limitations. You can not use a lot of
the T-SQL string manipulation functions against it, so you can't really do
much with it once you have it.
You can do a SELECT ... INTO ... to write it to a temporary table, then
select it into your @.test variable. I have not tried it, but is a
suggestion.
Regards
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Arun" <kathir_arun@.hotmail.com> wrote in message
news:ePOh0u8QFHA.576@.TK2MSFTNGP15.phx.gbl...
> Hi,
> I would like to generate an XML query using the 'for xml' clause and
> assign
> that to a text variable for further manipulation.
> for e.g., I would like to do some thing like this.
> declare @.test text
> Set @.test = Select * from test_table for xml auto
> But this gives my the syntax error. Can anyone help capturing the xml
> output
> of a query into a variable?
> Regards,
> Arun
>
No comments:
Post a Comment