SELECT x.i.value('.', 'VARCHAR(7)') as ID
to
SELECT x.i.value('.', 'int') as ID
if your IDs are indeed ints and not text.
Yes, I created this generically without knowing your data. You should change this to accommodate your data.
select * from (SELECT x.i.value('.', 'VARCHAR(7)') as IDFROM @x.nodes('//i') x(i)) b
:hehe: I guess I did forget to alias the column. Sorry about that.