Home Dashboard Directory Help
Search

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


Status: 

Active


5
0
Sign in
to vote
Type: Bug
ID: 790225
Opened: 6/14/2013 2:14:19 PM
Access Restriction: Public
0
Workaround(s)
view
3
User(s) can reproduce this bug

Description


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)

go

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

select
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.

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

Details
Sign in to post a comment.
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)
Sign in to post a workaround.