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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:58:53+00:00 2026-06-14T13:58:53+00:00

I have an xml string and need to manipulate it within sql. <RuleData ReturnVariable=>

  • 0

I have an xml string and need to manipulate it within sql.

<RuleData ReturnVariable="">
  <MateProperties>
    <Property Key="value" DisplayName="name value" />
    <Property Key="value2" DisplayName="name value2" />
  </MateProperties>
  <ReferenceNames>
    <Item Name="0" Value="=CouplerType + &quot;-1&quot;" />
    <Item Name="1" Value="Driveshaft-1" />
  </ReferenceNames>
  <ReferenceFeatures>
    *<Item Name="=CouplerType + &quot;-1&quot;" Value="CSYS_BOREB" />
    <Item Name="Driveshaft-1" Value="CSYS_CouplerINSIDE" />*
  </ReferenceFeatures>
</RuleData>

These two lines I need to convert them.

<Item Name="=CouplerType + &quot;-1&quot;" Value="CSYS_BOREB" />
<Item Name="Driveshaft-1" Value="CSYS_CouplerINSIDE" />

To This new format.

<Value>
  <Column Value="=CouplerType + &quot;" />
  <Column Value="CSYS_BOREB" />
</Value>
<Value>
  <Column Value="Driveshaft-1" />
  <Column Value="CSYS_CouplerINSIDE" />
</Value>

Essentially each line has to be split in two and re-named. I Can take care of the re-naming i just am having trouble splitting the columns. I have to do exactly the same thing in the ReferenceNames Section as well. That one is easier as Its always “0” and “1” so i can simply convert the xml to string and find replace with that. The ReferenceFeatures section though is more complicated because anything can be in the name section.

  • 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-14T13:58:54+00:00Added an answer on June 14, 2026 at 1:58 pm
    declare @xml xml =
        N'<RuleData>
            <ReferenceFeatures>
                <Item Name="=CouplerType + &quot;-1&quot;" Value="CSYS_BOREB" />
                <Item Name="Driveshaft-1" Value="CSYS_CouplerINSIDE" />
            </ReferenceFeatures>
        </RuleData>'
    
    ;with items as
    (
        select
            row_number() over (order by (select 1)) as RowNumber
            ,t.n.value('@Name', 'nvarchar(255)') as Name
            ,t.n.value('@Value', 'nvarchar(255)') as Value
        from @xml.nodes('//RuleData/ReferenceFeatures/Item') as t(n)
    )
    select
        (select it.Name as [@Value] for xml path ('Column'), type),
        (select it.Value as [@Value] for xml path ('Column'), type)
    from items it
    order by it.RowNumber
    for xml raw ('Value'), type
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an XML string as follows: <?xml version=1.0 encoding=utf-8?> <document id=0 name=RegSimple Version=0.1>
I have a xml document as string. I need to insert the data into
I need to parse XML string into an array. I have XML <group xmlns=123
I have an XML file which will output a string: <mystring> <manipulate type=caps> <string>Hello
I have a string(xml) and I need to store it temporarily as memory stream
I have replacement xml that has placeholder and its value. I have XML string
I have a xml string from other system, I need select xml as a
I have an xml string such as this: <s:Envelope xmlns:s=http://schemas.xmlsoap.org/soap/envelope/> <s:Body> <ExecuteResponse xmlns=http://schemas.microsoft.com/xrm/2011/Contracts/Services> <ExecuteResult
I have a xml string: <Test> Result : this is the result</Test> How do
I have an xml string below that I've turned into an object using $content

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.