XML Query exception when using primary xml index - by Mikael Eriksson SE

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 790225 Comments
Status Closed Workarounds
Type Bug Repros 3
Opened 6/14/2013 2:14:19 PM
Access Restriction Public


Running the code below gives this exception 

Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command.  The results, if any, should be discarded.

create table T
  ID int identity primary key,
  XMLCol xml

create primary xml index IX_T on T(XMLCol)


insert into T values('<root><item ID="1"/></root>')

  I.N.value('@Name', 'varchar(10)'),
  I.N.value('@ID', 'int')
from T
  cross apply T.XMLCol.nodes('/root/item') as I(N)

Change the order of columns in the query and all is fine.

  I.N.value('@ID', 'int'),
  I.N.value('@Name', 'varchar(10)')
from T
  cross apply T.XMLCol.nodes('/root/item') as I(N)

Sign in to post a comment.
Posted by Mikael Eriksson SE on 5/26/2016 at 4:20 AM
Any feedback on this? Would be interesting to know why it will not be fixed.
Posted by Microsoft on 11/25/2013 at 8:59 PM
Thanks for submitting this feedback. We will investigate this issue and get back to you.
Posted by Marian Chicu on 6/14/2013 at 3:46 PM
I can reproduce it, too, on SQL 2008 R2 Developer edition (10.50.4000.0) and on a 2012 Enterprise Eval (11.0.3128.0)