Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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!
share|improve this question

1 Answer 1

up vote 2 down vote accepted

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);
share|improve this answer
    
thanks you..... –  Qrosh Dec 13 '12 at 17:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.