input:
Declare @OUT xml
select @OUT = N'
<row>
<kind>MainCat</kind>
<sortid>1</sortid>
<kind_id>1</kind_id>
<PPoet>حافظ</PPoet>
<MTitle>حافظ</MTitle>
<Row>1</Row>
</row>'
select T.X.value('@Kind', 'nvarchar(50)') as kind,
T.X.value('@sortid', 'int') as sortid
from @out.nodes('/row') as T(X)
this select return NULL!
asked Dec 13, 2012 at 17:02
1 Answer 1
Very close:
select
T.X.value('./kind[1]', 'nvarchar(50)') as kind,
T.X.value('./sortid[1]', 'int') as sortid
from @out.nodes('/row') as T(X);
answered Dec 13, 2012 at 17:22
lang-sql