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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:50:05+00:00 2026-06-11T18:50:05+00:00

I need to load one of my tables in SQL server database with some

  • 0

I need to load one of my tables in SQL server database with some data from a xsd provided.

I have my XSD, with a block as below

<xsd:simpleType name="States">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="state1"/>
<xsd:enumeration value="state2"/>
<xsd:enumeration value="state3"/>
</xsd:restriction>
</xsd:simpleType>

In my table – States, I have 2 columns StateId,StateName.

I have to load the data such as state1,state2,..etc into the StateName column of the table.

Can somebody suggest which method should I use to get this done.

  • 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-11T18:50:06+00:00Added an answer on June 11, 2026 at 6:50 pm

    I would do it as follows:

    DECLARE @xml XML
    -- Add the schema information and make the XML a valid XML document to parse.
    SELECT @xml = '<?xml version="1.0"?>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
            <xsd:simpleType name="Countries">
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="Country1"/>
                    <xsd:enumeration value="Country2"/>
                    <xsd:enumeration value="Country3"/>
                </xsd:restriction>
            </xsd:simpleType>
            <xsd:simpleType name="States">
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="state1"/>
                    <xsd:enumeration value="state2"/>
                    <xsd:enumeration value="state3"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:schema>';
    
    WITH XMLNAMESPACES ('http://www.w3.org/2001/XMLSchema' as xsd)
    SELECT 
        node.value('@value', 'nvarchar(32)')
    FROM 
        @xml.nodes('/xsd:schema/xsd:simpleType[@name="States"]/xsd:restriction/xsd:enumeration') AS enum(node)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to load a model, existing of +/- 20 tables from the database
My Entity Framework model is generated from SQL Server database. Since I need to
For my current project in c# I need to transfer data from a SQL-Database
I need to load a couple of thousands of data files into SQL Server
I need to load a lot of data fetched from a mysql db in
I need to load some resource from my DLL (i need to load them
If i have SQL Server tables like this: Location ---------- LocationId int PK Field1
We have a lot of files, saved as binary in our SQL Server database.
I have a data load scenario where I create dynamic sql query to pull
I need to load one column of strings from table on SqlServer into Array

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.