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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:12:49+00:00 2026-05-28T00:12:49+00:00

I have a large XML note with many nodes. is there a way that

  • 0

I have a large XML note with many nodes.

is there a way that I can select only a single node and all of its contents from the larger XML?

i am using sql 2005

  • 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-28T00:12:49+00:00Added an answer on May 28, 2026 at 12:12 am

    You should use the query() Method if you want to get a part of your XML.

    declare @XML xml
    
    set @XML = 
    '
    <root>
      <row1>
        <value>1</value>
      </row1>
      <row2>
        <value>2</value>
      </row2>
    </root>
    '
    
    select @XML.query('/root/row2')
    

    Result:

    <row2>
      <value>2</value>
    </row2>
    

    If you want the value from a specific node you should use value() Method.

    select @XML.value('(/root/row2/value)[1]', 'int')
    

    Result:

    2
    

    Update:

    If you want to shred your XML to multiple rows you use nodes() Method.

    To get values:

    declare @XML xml
    
    set @XML = 
    '
    <root>
      <row>
        <value>1</value>
      </row>
      <row>
        <value>2</value>
      </row>
    </root>
    '
    
    select T.N.value('value[1]', 'int')
    from @XML.nodes('/root/row') as T(N)
    

    Result:

    (No column name)
    1
    2
    

    To get the entire XML:

    select T.N.query('.')
    from @XML.nodes('/root/row') as T(N)
    

    Result:

    (No column name)
    <row><value>1</value></row>
    <row><value>2</value></row>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large XML file (3000+ nodes) that I want to represent in
I have this large XML file. There is a field that I want to
I have a large xml document that needs to be processed 100 records at
I'm hand-coding Linq to SQL Entities and have a large XML column that I
I have rather large input XML files that must be converted to a given
Question We have a large number of xml configuration files that we want merged
i have a large XML document that is to large to be loaded using
I have a large xml file (1Gb). I need to make many queries on
I have a large xml file (40 Gb) that I need to split into
I have a large XML document that is around 100mb. I need to find

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.