Home > Archive > MS SQL XML > July 2005 > FOR XML EXPLICIT error: Undeclared tag ID









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author FOR XML EXPLICIT error: Undeclared tag ID
Craig HB

2005-07-27, 11:37 am

I am exporting xml from SQL Server 2000 using a FOR XML EXPLICIT query. It is
quite a big query: 56 SELECTs unions together and each one has 57 columns.

When I run it, I get the following error...
Server: Msg 6806, Level 16, State 2, Procedure DebitNotes_XmlDoc2, Line 10
Undeclared tag ID 50 is used in a FOR XML EXPLICIT query.

By the way, if I remove "FOR XML EXPLICIT", the remaining part works.

Does anyone know what that error means ?

Thanks,
Craig
markc600@hotmail.com

2005-07-27, 1:28 pm

Make sure you have a suitable ORDER BY clause at the end of your query.

Craig HB

2005-07-27, 8:24 pm

I tried adding "ORDER BY Tag" but I still got the same error. I added it just
before the "FOR XML EXPLICIT".

Is that right ? Or should I be doing something else ?
markc600@hotmail.com

2005-07-27, 8:24 pm

The ORDER BY clause will be dependent upon the rest of the query,
perhaps you could post your query (or a cut down version of it
if it is very big)

Michael Rys [MSFT]

2005-07-28, 3:24 am

The order by needs to make sure that the parent element is immediately
followed by its children.

The error message that you see means that a child element appears before its
parent.

Best regards
Michael

<markc600@hotmail.com> wrote in message
news:1122495791.208708.274880@g47g2000cwa.googlegroups.com...
> The ORDER BY clause will be dependent upon the rest of the query,
> perhaps you could post your query (or a cut down version of it
> if it is very big)
>



Craig HB

2005-07-28, 3:24 am

I have checked this and all parent elements are immediately followed by its
children.
Michael Rys [MSFT]

2005-07-28, 8:24 pm

Can you provide a repro case then?

Thanks
Michael

"Craig HB" <CraigHB@discussions.microsoft.com> wrote in message
news:E27D6043-CE20-4BE8-816E- 677A7B015D6B@microso
ft.com...
>I have checked this and all parent elements are immediately followed by its
> children.



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com