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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:13:16+00:00 2026-06-01T08:13:16+00:00

I want to generate XML from existing xml but values should come from some

  • 0

I want to generate XML from existing xml but values should come from some other table. For example I have following xml in a table:

<LABEL COLOR=RED> Account #: </LABEL>
<VALUE> ACCT_NUM </VALUE>
<LABEL COLOR=RED> Emp. Name: </LABEL>
<VALUE> Emp_Name </VALUE>

Table for data looks like this:

EmployeeAccount

ACCT_NUM   Emp_Name
1234       Kash

Now it should generate xml in following format

<LABEL COLOR=RED> Account #: </LABEL>
<VALUE> 1234 </VALUE>
<LABEL COLOR=RED> Emp. Name: </LABEL>
<VALUE> Kash </VALUE>

I can’t find any way of doing this after two days of googling.

I am using SQL Server 2008.

any help…

  • 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-01T08:13:18+00:00Added an answer on June 1, 2026 at 8:13 am

    I have done this using …

    `DECLARE @t TABLE (id INT, data XML)
    DECLARE @t2 TABLE (id INT, value varchar(50))
    
    INSERT INTO @t (id, data)
    SELECT 1,
    '
    <data>
      <label>1</label>
      <value>test</value>
    </data>
    '
    
    INSERT INTO @t2 (id, value)
    SELECT 1, 'Kash' union all
    SELECT 2, 'Moeen'
    
    --Update value of an element in xml from other table
    UPDATE t1
    SET data.modify
    (
    '
    replace value of (//value/text())[1] with sql:column("value")
    '
    )
    FROM @t t1
    INNER JOIN @t2 t2 on t1.id = t2.id
    
    SELECT data FROM @t
    `
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to generate xml file from Struts action object. So that I have
I have an XML document that I want to generate unique IDs for. Some
I asked this question before: Generate XML from a class I want to do
I want to create an XSD which can generate the following XML. <note> <email:to>abc@def.com</email:to>
I've read a time ago about generate xml from Java using annotations, but I'm
I want to generate raw xml from a REST service using Spring. Something is
I want to generate java code from xsd using JAXB 2.1 XJC. I have
I want to generate some XML in a stored procedure based on data in
I'm using this code in order to generate XML from my grid's cells values:
I've read about how you can generate changelog.xml from an existing schema. That's fine,

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.