Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8343587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:06:41+00:00 2026-06-09T06:06:41+00:00

I want to fetch data from xml in stored procedure, but it returns null

  • 0

I want to fetch data from xml in stored procedure, but it returns null for every record please help!!

Below is my script I used in Stored Procedure to fetch records:

declare @deviceData xml
set @deviceData = 
'<result>
   <resultTotalRows>24</resultTotalRows>
   <requestedStartRow>0</requestedStartRow>
   <resultSize>24</resultSize>
   <requestedSize>1000</requestedSize>
   <remainingSize>0</remainingSize>
   <DiaChannelDataHistoryFull>
      <id>
         <devConnectwareId>00000000-00000000-00409DFF-FF521221</devConnectwareId>
         <ddInstanceName>bpcuff1</ddInstanceName>
         <dcChannelName>diastolic</dcChannelName>
         <dcdhId>549747901</dcdhId>
      </id>
      <cstId>6423</cstId>
      <xpExtAddr>00:13:A2:00:40:6B:95:43</xpExtAddr>
      <dcDataType>0</dcDataType>
      <dcdUpdateTime>2012-07-31T20:53:44.000Z</dcdUpdateTime>
      <dcdStringValue>82</dcdStringValue>
      <dcdIntegerValue>82</dcdIntegerValue>
   </DiaChannelDataHistoryFull>
</result>'

declare @xmltable table (PatientID int, GatewayId nvarchar(255), DeviceName nvarchar(255), TimeStamp datetime, Systolic int, Diastolic int, Pulse int, Status nvarchar(255))
insert into @xmltable (PatientID, GatewayId, DeviceName, TimeStamp, Systolic, Diastolic, Pulse, Status)
select
1 as PatientID,
tbl.clms.value('@devConnectwareId','nvarchar(255)') as GatewayId,
tbl.clms.value('@ddInstanceName','nvarchar(255)') as DeviceName,
tbl.clms.value('@dcdUpdateTime','datetime') as TimeStamp,
case tbl.clms.value('@dcChannelName','nvarchar(255)') when 'Systolic' then tbl.clms.value('@dcdStringValue','nvarchar(255)') else null end as Systolic,
case tbl.clms.value('@dcChannelName','nvarchar(255)') when 'Diastolic' then tbl.clms.value('@dcdStringValue','nvarchar(255)') else null end as Diastolic,
case tbl.clms.value('@dcChannelName','nvarchar(255)') when 'Pulse' then tbl.clms.value('@dcdStringValue','nvarchar(255)') else null end as Pulse,
case tbl.clms.value('@dcChannelName','nvarchar(255)') when 'Sample_Status' then tbl.clms.value('@dcdStringValue','nvarchar(255)') else null end as Status
from @deviceData.nodes('/result/DiaChannelDataHistoryFull') tbl(clms)

select * from @xmltable
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T06:06:44+00:00Added an answer on June 9, 2026 at 6:06 am

    Using @ is for attributes not node values and you have to give the path to the id node for the values that is in there.

    select
    1 as PatientID,        
    tbl.clms.value('(id/devConnectwareId)[1]','nvarchar(255)') as GatewayId,
    tbl.clms.value('(id/ddInstanceName)[1]','nvarchar(255)') as DeviceName,
    tbl.clms.value('dcdUpdateTime[1]','datetime') as TimeStamp,
    case tbl.clms.value('(id/dcChannelName)[1]','nvarchar(255)') when 'Systolic' then tbl.clms.value('dcdStringValue[1]','nvarchar(255)') else null end as Systolic,
    case tbl.clms.value('(id/dcChannelName)[1]','nvarchar(255)') when 'Diastolic' then tbl.clms.value('dcdStringValue[1]','nvarchar(255)') else null end as Diastolic,
    case tbl.clms.value('(id/dcChannelName)[1]','nvarchar(255)') when 'Pulse' then tbl.clms.value('dcdStringValue[1]','nvarchar(255)') else null end as Pulse,
    case tbl.clms.value('(id/dcChannelName)[1]','nvarchar(255)') when 'Sample_Status' then tbl.clms.value('dcdStringValue[1]','nvarchar(255)') else null end as Status
    from @deviceData.nodes('/result/DiaChannelDataHistoryFull') tbl(clms)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In asp.net(C#) i want to fetch data from a database using a stored procedure
i Want to fetch this data using json decode. Please Help.. So far i
I want to create my own RSS/XML feed. I fetch data from the database
I have got a PHP/HTML page where I want to fetch data from but
I want to fetch the data from a xml file and then push into
I want write a simple query which will fetch data from a table (which
I want fetch last record using hibernate criteria Can u help me?
I want to fetch data from this URL: http://webservices.ns.nl/ns-api-stations . This URL requires a
I'm a beginner, I want to fetch data from Zoho Crm and then insert
So i am generating a XML file based on data from mysql tables but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.