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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:54:21+00:00 2026-05-15T19:54:21+00:00

If you have this xml <AssetComponent name=AssetComponent4881 width=300> <Asset id=5 type=1 /> </AssetComponent> <AssetComponent

  • 0

If you have this xml

<AssetComponent name="AssetComponent4881" width="300">
  <Asset id="5" type="1" />
</AssetComponent>
<AssetComponent name="AssetComponent4882" width="300">
  <Asset id="5" type="1" />
</AssetComponent>

Is it possible to replace all the ids from 5 to 6 in one query?

With this sql only one attribute at the time can be replaced:

SET @myDoc.modify('
  replace value of (//Asset/@id)[1]
  with     sql:variable("@BinaryAssetId")
')

From the sql docs I can see that the replace should return a atomic node, just one, so is there another way to do this?

  • 1 1 Answer
  • 1 View
  • 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-15T19:54:22+00:00Added an answer on May 15, 2026 at 7:54 pm

    The last time I looked into this, there was no such way – replace only operates on a single item at a time. The (unpleasant) solution I came up with at the time was (pseudo code) this:

    Suppose we want to change records from one state to another; let us call those states the ‘from’ state (eg having Asset/@id = '5') and the ‘to’ state (eg having Asset/@id = '6'). Then execute this loop:

    WHILE there exists a record that is in the 'from' state
        BEGIN
        Execute a .modify that changes the first record in the 'from' state 
            to being in the 'to' state
        END
    

    It’s not pretty, but it works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this XML: <root> <tab name=Detail> <section name=mysection> <items level=1> <Idx_name>9</Idx_name> <Type>mytype</Type> <item
I have this xml <products> <product> <name>Demo</name> </product> <product> <name>Black Beauty III</name> <description>Beautiful les
I have this xml file which has text init. i.e Hi my name is
I have this xml file <?xml version=1.0 encoding=UTF-8?> <bo:C837ClaimParent xsi:type=bo:C837ClaimParent xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:bo=http://somelongpathHere/process/bo> <claimAux> ...
I have this XML: <states> <state name=Alaska colour=#6D7B8D> <Location Name=loc1> <Address>a1</Address> <DateNTime>a2</DateNTime> </Location> <Location
I have this XML file: <continents> <continent1 id=EUR name=EUROPE></continent1> <continent2 id=AME name=AMERICA></continent2> </continents> I
I have this XML i want display all fields on the uiview which comes
I have this XML document <AdditionalParameters> <PublishToPdf Type =System.Boolean>False</PublishToPdf> </AdditionalParameters> in my code and
I have this xml data format. I would like to extract the properties name
I have this xml: <mappings> <mapping> <name iskey=true>234</name> <aid iskey=true>bmz</aid> <bid iskey=true>sim</bid> <data>GSSS</data> </mapping>

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.