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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:03:49+00:00 2026-05-26T04:03:49+00:00

DECLARE @tProduct TABLE ( [pProductId] [smallint] IDENTITY(1,1) PRIMARY KEY NOT NULl, [ProductDetails] [xml] NOT

  • 0
DECLARE @tProduct TABLE (
  [pProductId] [smallint] IDENTITY(1,1) PRIMARY KEY NOT NULl,
  [ProductDetails] [xml] NOT NULL
)

  INSERT @tProduct 
    ( [ProductDetails] ) 
  VALUES 
    ( N'<product>
         <placeholder name="ProductHeader"><control name="pdRequiredMainHeading"><text position="placeholder1">Blah blah</text></control></placeholder>
         <placeholder name="LeftColumn">
           <control name="pdRequiredSubHeading"><text position="placeholder1">Blah blah</text><text position="placeholder2">Blah blah</text></control>
           <control name="pdRequiredParagraph"><text position="placeholder1">Blah blah</text></control>
           <control name="pdOverlinedUnderlinedHeading"><text position="placeholder1">Blah blah</text></control>
           <control name="pdParagraph"><text position="placeholder1">Blah blah</text></control>
          </placeholder>
          <placeholder name="RightColumn">
              <control name="pdRequiredMediumImage"><image position="placeholder1" alt="Blah blah">Blahblah.gif</image></control>
              <control name="pdMediumImage"><image position="placeholder1" alt="">BlahBlah2.gif</image></control>
              <control name="pdRoundedBorderHeadingUnorderedList"><text position="placeholder1">Blah blah</text><ul position="placeholder2"><li>Blah blah</li></ul></control>
              <control name="pdMediumImage"><image position="placeholder1" alt="">The-Image-I-Want-1.gif</image></control>
          </placeholder>
       </product>' )

  INSERT @tProduct 
    ( [ProductDetails] ) 
  VALUES 
    ( N'<product>
         <placeholder name="ProductHeader"><control name="pdRequiredMainHeading"><text position="placeholder1">Blah blah</text></control></placeholder>
         <placeholder name="LeftColumn">
           <control name="pdRequiredSubHeading"><text position="placeholder1">Blah blah</text><text position="placeholder2">Blah blah</text></control>
           <control name="pdRequiredParagraph"><text position="placeholder1">Blah blah</text></control>
           <control name="pdOverlinedUnderlinedHeading"><text position="placeholder1">Blah blah</text></control>
           <control name="pdParagraph"><text position="placeholder1">Blah blah</text></control>
         </placeholder>
         <placeholder name="RightColumn">
           <control name="pdRequiredMediumImage"><image position="placeholder1" alt="Blah blah">Blahblah.gif</image></control>
           <control name="pdRoundedBorderHeading"><text position="placeholder1">Blah blah</text><ul position="placeholder2"><li>Blah blah</li></ul></control>
           <control name="pdMediumImage"><image position="placeholder1" alt="">The-Image-I-Want-12.gif</image></control>
         </placeholder>
       </product>' )

  INSERT @tProduct 
    ( [ProductDetails] ) 
  VALUES 
    ( N'<product>
         <placeholder name="ProductHeader"><control name="pdRequiredMainHeading"><text position="placeholder1">Blah blah</text></control></placeholder>
         <placeholder name="LeftColumn">
           <control name="pdRequiredSubHeading"><text position="placeholder1">Blah blah</text><text position="placeholder2">Blah blah</text></control>
           <control name="pdRequiredParagraph"><text position="placeholder1">Blah blah</text></control>
           <control name="pdOverlinedUnderlinedHeading"><text position="placeholder1">Blah blah</text></control>
           <control name="pdParagraph"><text position="placeholder1">Blah blah</text></control>
         </placeholder>
         <placeholder name="RightColumn">
           <control name="pdRequiredMediumImage"><image position="placeholder1" alt="">The-Image-I-Want-1.gif123.gif</image></control>
           <control name="pdRoundedBorderHeadingUnorderedList"><text position="placeholder1">Blah blah</text><ul position="placeholder2"><li>Blah blah</li></ul></control>
           <control name="pdMediumImage"><image position="placeholder1" alt="Blah blah">Blahblah.gif</image></control>
         </placeholder>
       </product>' )

  INSERT @tProduct 
    ( [ProductDetails] ) 
  VALUES 
    ( N'<product>
         <placeholder name="ProductHeader"><control name="pdRequiredMainHeading"><text position="placeholder1">Blah blah</text></control></placeholder>
         <placeholder name="LeftColumn">
           <control name="pdRequiredSubHeading"><text position="placeholder1">Blah blah</text><text position="placeholder2">Blah blah</text></control>
           <control name="pdRequiredParagraph"><text position="placeholder1">Blah blah</text></control>
           <control name="pdOverlinedUnderlinedHeading"><text position="placeholder1">Blah blah</text></control>
           <control name="pdParagraph"><text position="placeholder1">Blah blah</text></control>
         </placeholder>
         <placeholder name="RightColumn">
           <control name="pdRequiredMediumImage"><image position="placeholder1" alt="">The-Image-I-Want-1.gif1234.gif</image></control>
           <control name="pdRoundedBorder"><text position="placeholder1">Blah blah</text><ul position="placeholder2"><li>Blah blah</li></ul></control>
           <control name="pdMediumImage"><image position="placeholder1" alt="Blah blah">Blahblah.gif</image></control>
         </placeholder>
       </product>' )

  -- ITS AN UPDATE I WANT BUT EVEN THIS I CANT GET TO WORK AS IT DOESNT BRING BACK EVERY IMAGE

  SELECT pProductId, ProductDetails
  FROM @tProduct
  WHERE (ProductDetails.nodes('(//product/placeholder/control/image)') LIKE 'The-Image-I-Want-%')

Ive tried various versions of this including WHERE ProductDetails.value but again I can bring back some nodes but not all.

Im tryin to create an update query that removes the numbers from Image-I-Want-.gif.

i.e.

 Image-I-Want-1.gif   becomes Image-I-Want-.gif

 Image-I-Want-12.gif  becomes Image-I-Want-.gif

 Image-I-Want-123.gif becomes Image-I-Want-.gif

etc etc.

But I cant even make it select all the required images let alone update them. Its the xQuery syntax I cant quite get right nor can I find a good example as everything I try has errored so far.

I could script this in c# or some equvalent but Id really like to know how to do it in Transact-Sql using xQuery without using a loop if possible etc like a simple update query.

  • 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-26T04:03:50+00:00Added an answer on May 26, 2026 at 4:03 am

    The query:

    select pProductId, ProductDetails 
    from @tProduct
    where ProductDetails.exist('/product/placeholder/control/image[contains(., "The-Image-I-Want-")]') = 1
    

    The update:

    update @tProduct
    set ProductDetails.modify('replace value of (/product/placeholder/control/image[contains(., "The-Image-I-Want-")]/text())[1] with "The-Image-I-Want-.gif"')
    where ProductDetails.exist('/product/placeholder/control/image[contains(., "The-Image-I-Want-")]') = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

DECLARE @T TABLE ( ID BIGINT IDENTITY PRIMARY KEY, FaceBookID BIGINT NULL, TwitterID BIGINT
declare @T table ( ID int identity primary key, FBK_ID BIGINT null, TWT_ID BIGINT
DECLARE @CURRENTSCHOOL TABLE (STUDENT VARCHAR(8), COURSE VARCHAR(8), SCHOOL VARCHAR(2)) INSERT INTO @CURRENTSCHOOL VALUES ('10000000','MCR1010','11')
DECLARE @table table(XYZ VARCHAR(8) , id int) INSERT INTO @table SELECT '4000', 1 UNION
declare @t1 Table ( a1 int ) insert into @t1 select top 10 AnimalID
DECLARE @x xml SET @x='<data> <add key=images value=image/path/img.gif>a</add> <add key=images2 value=image/path/img2.gif >b</add> <add key=images3
DECLARE @OrdersTemp TABLE ( OrderId UNIQUEIDENTIFIER ) INSERT INTO @OrdersTemp SELECT ord.Id FROM Orders
DECLARE @t TABLE(Words VARCHAR(100)) INSERT INTO @t SELECT 'Stack Overflow' UNION ALL SELECT 'EQUATORIAL'
declare @t table ( id int, SomeNumt int ) insert into @t select 1,10
DECLARE @myXml XML SET @myXml = CONVERT(xml, '<a key=2></a>', 1) SELECT s.value('@key', 'VARCHAR(8000)') AS

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.