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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:13:11+00:00 2026-05-26T12:13:11+00:00

I have a XML column in database that may look like that ones: <sql-connection-info

  • 0

I have a XML column in database that may look like that ones:

<sql-connection-info name="myname" server="(local)\SQLEXPRESS" other-attribute="value" />

<oracle-connection-info name="othername" server="address" other-attribute="value" />

and so on. The names of nodes and attributes can be nearly anything. I need to iterate over the attribute/value pair on the first node. Every sample I have seen was for known node/attribute names.

When I tried to use

@xmlColumn.query("/@*")

I get this error

XQuery [query()]: Top-level attribute nodes are not supported.

Is this possible in TSQL? If yes how can I do this?

  • 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-26T12:13:12+00:00Added an answer on May 26, 2026 at 12:13 pm
    declare @xmlColumn xml = '<sql-connection-info name="myname" server="(local)\SQLEXPRESS" other-attribute="value" />'
    
    select T.N.value('local-name(.)', 'varchar(max)') as Name,
           T.N.value('.', 'varchar(max)') as Value
    from @xmlColumn.nodes('//@*') as T(N)
    

    Result:

    Name              Value
    ----------------  -------------------
    name              myname
    server            (local)\SQLEXPRESS
    other-attribute   value
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml column in my SQL Server database that has records in
I have a SQL Server database that contains an xml column. I need to
I'm using MS SQL Server 2008. I have a column of type XML that
In my SQL 2008 database table, I have one column name AUTHOR that contains
I have saved a dataset in the sql database in an xml column using
I'm hand-coding Linq to SQL Entities and have a large XML column that I
I have a few windwos services. They get xml column from Sql server manipulate
I have some XML code that looks like this <SEARCHRESULTS> <FUNCTION name=BarGraph> <PARAMETER name=numList></PARAMETER>
I have serialized an object into a XML column in my SQL Server 2008
I have a students xml from a database. The student_state column can have a

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.