Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

quering xml data

$
0
0

declare @data xml

set @data = '<Data ID="34" ORGANIZATION="2301" STATUS="Active" PER_ID="5833" PERSON_NAME="John Smith" />'

select
        T.C.value('ID[1]', 'nvarchar(128)') AS ID,
        T.C.value('ORGANIZATION[1]', 'nvarchar(128)') AS ORGANIZATION,
        T.C.value('STATUS[1]', 'nvarchar(128)') AS [STATUS],
        T.C.value('PER_ID[1]', 'nvarchar(128)') AS PER_ID,
        T.C.value('PERSON_NAME[1]', 'nvarchar(128)') AS PERSON_NAME
from @Data.nodes('Data') as T(C)    

Hi all

I have this data, but when I query the xml, I am getting all NULL data. can you please tell me what I did wrong

Thanks


sqldev


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>