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 6607155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:28:22+00:00 2026-05-25T19:28:22+00:00

I am getting error in updating columns using XML but don’t know where is

  • 0

I am getting error in updating columns using XML but don’t know where is the problem. Please guide me to get the rid out of it..
This is part of the code for my stored procedure

IF(@Mode='UPDATE_TABLE')
BEGIN
    ;WITH XmlData AS 
        (
            SELECT
                NDS.DT.value('(ClaimExpenseID)[1]', 'int') AS 'ClaimExpenseID',
                NDS.DT.value('(ClaimID)[1]', 'int') AS 'ClaimID',
                NDS.DT.value('(POrderID)[1]', 'int') AS 'POrderID',
                NDS.DT.value('(SiteID)[1]', 'int') AS 'SiteID',
                NDS.DT.value('(FromDate)[1]', 'datetime') AS 'FromDate',
                NDS.DT.value('(ToDate)[1]', 'datetime') AS 'ToDate',
                NDS.DT.value('(PearticularID)[1]', 'int') AS 'ParticularID',
                NDS.DT.value('(Description)[1]', 'varchar(200)') AS 'Description',
                NDS.DT.value('(SubmitAmount)[1]', 'int') AS 'SubmittedAmount',
                NDS.DT.value('(CreatedDate)[1]', 'datetime') AS 'CreatedDate',
                NDS.DT.value('(ApprovedAmount)[1]', 'int') AS 'ApprovedAmount',
                NDS.DT.value('(ApprovedDate)[1]', 'datetime') AS 'ApprovedDate',
                NDS.DT.value('(Remark)[1]', 'varchar(300)') AS 'Remark',
                NDS.DT.value('(ApprovedBy)[1]', 'int') AS 'ApprovedBy',                 
                NDS.DT.value('(RowInfo)[1]', 'varchar(20)') AS 'RowInfo'

            FROM 
                @xmlString.nodes('/NewDataSet/DataTable') AS NDS(DT)

        )

        MERGE INTO dbo.ClaimExpenseTRS CET
        USING XmlData x ON CET.ClaimExpenseID = x.ClaimExpenseID
        WHEN MATCHED AND x.RowInfo = 'UPDATE'
           THEN 
             UPDATE SET 
                CET.ClaimID=x.ClaimID,  
                CET.CreatedDate=x.CreatedDate,
                CET.POrderID=x.POrderID,
                CET.SiteID=x.SiteID,
                CET.FromDate=x.FromDate,
                CET.ToDate=x.ToDate,
                CET.ParticularID=x.ParticularID,
                CET.Description=x.Description,
                CET.SubmittedAmount=x.SubmittedAmount,
                CET.ApprovedAmount=x.ApprovedAmount,
                CET.Remarks=x.Remark,
                CET.ApproveBy=x.ApprovedBy,
                CET.ApprovedDate=x.ApprovedDate

      WHEN MATCHED AND x.RowInfo = 'DELETE'AND CET.ClaimExpenseID = x.ClaimExpenseID
           THEN DELETE 

        WHEN NOT MATCHED AND x.RowInfo = 'NEW'
           THEN 
              INSERT(ClaimID, CreatedDate, POrderID, SiteID,FromDate,ToDate,ParticularID,                 Description,SubmittedAmount,ApprovedAmount,Remarks,ApproveBy,ApprovedDate)
              VALUES(x.ClaimID,x.CreatedDate,x.POrderID,x.SiteID,x.FromDate,x.ToDate,x. 
              ParticularID,x.Description,x.SubmittedAmount,x.ApprovedAmount,x.Remark,x.                   ApprovedBy,x.ApprovedDate);
END 

This is my XML script..

<NewDataSet>
  <DataTable>
    <ClaimExpenseID>14</ClaimExpenseID>
    <ClaimID>10</ClaimID>
    <CreatedDate>2011-09-14T02:00:00+05:30</CreatedDate>
    <POrderID>11</POrderID>
    <SiteID>1</SiteID>
    <FromDate>2011-09-18T00:00:00+05:30</FromDate>
    <ToDate>2011-09-20T00:00:00+05:30</ToDate>
    <NoOfDays>2</NoOfDays>
    <ParticularID>1</ParticularID>
    <Description>Restaurant123 </Description>
    <SubmittedAmount>200</SubmittedAmount>
    <Month>September</Month>
    <Year>2011</Year>
    <POrderNo>UNINOR</POrderNo>
    <SiteName>ALKAPURI</SiteName>
    <ParticulerName>Food</ParticulerName>
    <RowInfo>UPDATE</RowInfo>
    <TableRowIndex>0</TableRowIndex>
  </DataTable>
  <DataTable>
     <ClaimExpenseID>15</ClaimExpenseID>
    <ClaimID>10</ClaimID>
    <CreatedDate>2011-09-15T00:00:00+05:30</CreatedDate>
    <POrderID>10</POrderID>
    <SiteID>2</SiteID>
    <FromDate>2011-09-16T00:00:00+05:30</FromDate>
    <ToDate>2011-09-17T00:00:00+05:30</ToDate>
    <NoOfDays>1</NoOfDays>
    <ParticularID>2</ParticularID>
   <Description>bus</Description>
   <SubmittedAmount>100</SubmittedAmount>
   <Month>September</Month>
   <Year>2011</Year>
   <POrderNo>PO-00120</POrderNo>
   <SiteName>NIZAMPURA</SiteName>
   <ParticulerName>Traveling123</ParticulerName>
   <RowInfo>UNCHANGED</RowInfo>
   <TableRowIndex>1</TableRowIndex>
 </DataTable>

When I run this script, it stores NULL for particularID and for SubmittedAmount both.

  • 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-05-25T19:28:22+00:00Added an answer on May 25, 2026 at 7:28 pm

    Change PearticularID to ParticularID and SubmitAmount to SubmittedAmount.

    SELECT
        NDS.DT.value('(ClaimExpenseID)[1]', 'int') AS 'ClaimExpenseID',
        NDS.DT.value('(ClaimID)[1]', 'int') AS 'ClaimID',
        NDS.DT.value('(POrderID)[1]', 'int') AS 'POrderID',
        NDS.DT.value('(SiteID)[1]', 'int') AS 'SiteID',
        NDS.DT.value('(FromDate)[1]', 'datetime') AS 'FromDate',
        NDS.DT.value('(ToDate)[1]', 'datetime') AS 'ToDate',
        NDS.DT.value('(ParticularID)[1]', 'int') AS 'ParticularID',
        NDS.DT.value('(Description)[1]', 'varchar(200)') AS 'Description',
        NDS.DT.value('(SubmittedAmount)[1]', 'int') AS 'SubmittedAmount',
        NDS.DT.value('(CreatedDate)[1]', 'datetime') AS 'CreatedDate',
        NDS.DT.value('(ApprovedAmount)[1]', 'int') AS 'ApprovedAmount',
        NDS.DT.value('(ApprovedDate)[1]', 'datetime') AS 'ApprovedDate',
        NDS.DT.value('(Remark)[1]', 'varchar(300)') AS 'Remark',
        NDS.DT.value('(ApprovedBy)[1]', 'int') AS 'ApprovedBy',                 
        NDS.DT.value('(RowInfo)[1]', 'varchar(20)') AS 'RowInfo'
    
    FROM 
        @xml.nodes('/NewDataSet/DataTable') AS NDS(DT)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using postgres and I'm getting the duplicate key error when updating a row:
I'm getting this git error and I don't really get what it means, nor
I'm getting below error while updating two tables using entity framework - Object with
I'm updating application for Mac OS X 10.6 and getting this error. I believe
I wrote following code...but i am getting Error like: Error 1 'LoginDLL.Class1.Login(string, string, string)':
hi im new to c# and was trying to code but getting error can
at the moment im loading xml and i am getting error: System.Xml.XmlException: ' ',
I am getting an error when updating a DataWindow which says Row changed between
I been getting a really nasty error when updating a Service Reference for a
I am getting this error message in the web service when i am updating

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.