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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:51:43+00:00 2026-06-07T23:51:43+00:00

Say I have the following situation (for demonstration). The simple table content is converted

  • 0

Say I have the following situation (for demonstration). The simple table content is converted to an XML value and sent via Service Broker to another SQL server where the result of the SELECT is to be stored in the non-XML form (i.e. usual, simple database table). Let’s try:

CREATE TABLE tab (a int, b int, c int);
GO

INSERT INTO tab (a, b, c) VALUES (1, 11, 111);
INSERT INTO tab (a, b, c) VALUES (2, 22, 222);
INSERT INTO tab (a, b, c) VALUES (3, 33, 333);
INSERT INTO tab (a, b, c) VALUES (4, 44, 444);
GO

SELECT * FROM tab FOR XML RAW, TYPE;
GO

When capturing the value to the message, it looks like:

<row a="1" b="11" c="111" />
<row a="2" b="22" c="222" />
<row a="3" b="33" c="333" />
<row a="4" b="44" c="444" />

i.e. single multiline string. Say, I create the exactly same table structure at the destination machine:

CREATE TABLE tab_destination (a int, b int, c int);

What is the best way to extract the rows from the @msg, and how to put them to the destination table?

Thanks, Petr

  • 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-07T23:51:45+00:00Added an answer on June 7, 2026 at 11:51 pm
    CREATE TABLE tab (a int, b int, c int); 
    GO 
    
    INSERT INTO tab (a, b, c) VALUES (1, 11, 111); 
    INSERT INTO tab (a, b, c) VALUES (2, 22, 222); 
    INSERT INTO tab (a, b, c) VALUES (3, 33, 333); 
    INSERT INTO tab (a, b, c) VALUES (4, 44, 444); 
    GO 
    
    CREATE TABLE tab_destination (a int, b int, c int); 
    go
    
    declare @x xml = (SELECT * FROM tab FOR XML RAW, TYPE); 
    
    insert into tab_destination (a, b, c)
    select 
        x.value('@a', 'int'),
        x.value('@c', 'int'),
        x.value('@b', 'int')
        from @x.nodes('//row') t(x);
    GO 
    
    select * from tab_destination;
    go
    

    Time to read xml Data Type Methods

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

Sidebar

Related Questions

Situation Say I have the following: a table items a table lists to which
Let's say I have following table like this <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0
I have the following situation I have a couple of table rows within a
Let's say that I have following situation. I have many customers and many consultans,
i have the following situation : with my function i get an XML file
i have an situation where i have a following table. create table Bulk_Data (
Let's say I have the following situation: myrepo/ foo.txt bar.txt baz.txt quux.txt bingo.txt In
Folks, Let's say that I have the following situation: <div class=outer> <div> <span> <ul>
I am curious how people are handling the following situation. Let's say we have
I'm looking for solution of the following situation. Let's say I have a business

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.