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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:11:02+00:00 2026-05-27T07:11:02+00:00

I need to import the following XML into SQL Server 2008 R2: <Role ID=ef63f979-c65d-421a-a214-7319c6279e13

  • 0

I need to import the following XML into SQL Server 2008 R2:

<Role
  ID="ef63f979-c65d-421a-a214-7319c6279e13" >
  <Privileges>
    <Privilege ID="1" />
    <Privilege ID="2" />
    <Privilege ID="3" />
    <Privilege ID="4" />
    <Privilege ID="5" />
  </Privileges>
</Role>

I am able to do this using a table variable and parsing the XML twice, but am unable to get this into a relational table in one parse. Is that possible? Here is the expected result set:

EF63F979-C65D-421A-A214-7319C6279E13    1   2011-12-05 06:51:11.9065096 EF63F979-C65D-421A-A214-7319C6279E13
EF63F979-C65D-421A-A214-7319C6279E13    2   2011-12-05 06:51:11.9065096 EF63F979-C65D-421A-A214-7319C6279E13
EF63F979-C65D-421A-A214-7319C6279E13    3   2011-12-05 06:51:11.9065096 EF63F979-C65D-421A-A214-7319C6279E13
EF63F979-C65D-421A-A214-7319C6279E13    4   2011-12-05 06:51:11.9065096 EF63F979-C65D-421A-A214-7319C6279E13
EF63F979-C65D-421A-A214-7319C6279E13    5   2011-12-05 06:51:11.9065096 EF63F979-C65D-421A-A214-7319C6279E13

Thanks,

Raj

  • 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-27T07:11:02+00:00Added an answer on May 27, 2026 at 7:11 am

    I can extract this :

    DECLARE @input XML = '<Role
      ID="ef63f979-c65d-421a-a214-7319c6279e13" >
      <Privileges>
        <Privilege ID="1" />
        <Privilege ID="2" />
        <Privilege ID="3" />
        <Privilege ID="4" />
        <Privilege ID="5" />
      </Privileges>
    </Role>'
    
    SELECT
        @input.value('(/Role/@ID)[1]', 'uniqueidentifier') AS 'ID',
        T.C.value('(@ID)[1]', 'int') AS 'Privilege'
    FROM
        @input.nodes('/Role/Privileges/Privilege') AS T(C)
    

    Gives output:

    ID                                     Privilege
    EF63F979-C65D-421A-A214-7319C6279E13    1
    EF63F979-C65D-421A-A214-7319C6279E13    2
    EF63F979-C65D-421A-A214-7319C6279E13    3
    EF63F979-C65D-421A-A214-7319C6279E13    4
    EF63F979-C65D-421A-A214-7319C6279E13    5
    

    but I have no clue where your date/time comes from…..

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

Sidebar

Related Questions

I need to import the .sql file of PHP myadmin into SQL Server 2008.
I need to import a database into a SQL Server instance using a batch
I need to import the following packages into Eclipse Java EE IDE: https://svn.win.tue.nl/repos/cpntools/AccessCPN/trunk/ I
I need to import sheets which look like the following: March Orders ***Empty Row
I need to import some Excel spreadsheets into Java objects. I will use POI
I need to import some ANSI C code into a project I'm working on.
i need to import a mysql file into my access db. how do i
I currently have the following block of SQL 2005 code. What I need to
The following code causes the well-known UnicodeDecodeError: 'ascii' codec can't decode error: import xml.sax
I need to import data from *.dmp file say mydump.dmp. What I'm doing is:

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.