Monday, March 26, 2012

Insert XML RAW's output to a table

Under SQL 2000 i would like to convert and XML RAW output to text type
by using "convert" and/or insert the data into a table, is this
posible?
i.e. this statement runs ok under SQL 2k5 but fails under SQL 2k
SELECT CONVERT( text, (SELECT * FROM MyTable FOR XML RAW) )
SQL2000 reports:
-- Msg 170, Level 15, State 1, Line 1
-- Line 1: Incorrect syntax near 'XML'.
Thanks in advance.
Rod wrote:

> i.e. this statement runs ok under SQL 2k5 but fails under SQL 2k
> SELECT CONVERT( text, (SELECT * FROM MyTable FOR XML RAW) )
> SQL2000 reports:
> -- Msg 170, Level 15, State 1, Line 1
> -- Line 1: Incorrect syntax near 'XML'.
Have you tried to select into a variable first and then convert that
variable?

Martin Honnen -- MVP XML
http://JavaScript.FAQTs.com/
|||This can't be done on the server in SQL Server 2000. You would have to use
a client connection to select the data and then push it back to the server.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Martin Honnen" <mahotrash@.yahoo.de> wrote in message
news:OhRh%23m%23vHHA.4796@.TK2MSFTNGP04.phx.gbl...
> Rod wrote:
>
> Have you tried to select into a variable first and then convert that
> variable?
>
> --
> Martin Honnen -- MVP XML
> http://JavaScript.FAQTs.com/
|||On 6 jul, 23:09, "Roger Wolter[MSFT]" <rwol...@.online.microsoft.com>
wrote:
> This can't be done on the server in SQL Server 2000. You would have to use
> a client connection to select the data and then push it back to the server.
>
Found this to be true, under SQL Server 2000 it's not possible to use
XML RAW inside a subquery, trying to do it will throw an error.
(still, the same unmodified
clause may work under SQL Server 2005)
Thanks

No comments:

Post a Comment