.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to create tables from XSD schema?

Posted By:      Posted Date: September 26, 2010    Points: 0   Category :Sql Server

I am newbie for xsd/xml.
Can you give me an idea how to create tables from the xsd at below.


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="listings" type="listingsType"/>
  <xs:complexType name="componentType">
      <xs:extension base="xs:string">
        <xs:attribute type="xs:string" name="name" use="optional"/>
  <xs:complexType name="addressType">
      <xs:element type="componentType" name="component" maxOccurs="unbounded" minOccurs="0"/>
    <xs:attribute type="xs:string" name="format" use=&qu

View Complete Post

More Related Resource Links

Metadata: Create a Database Schema Repository with Meta Data Services in SQL Server 2000


SQL Server 2000 Meta Data Services is a repository technology that stores and manages metadata for SQL Server. Instead of building database schemas over and over, Meta Data Services allows you to freeze an entire schema for use in other projects. You can also use these schemas for training, testing, or debugging. In this article, the authors will review the various components of Meta Data Services and show how it can be programmed using a Visual Basic client, XML, and XSLT. They will also show you how to manage and manipulate your metadata by generating a simple database schema using a SQL Server repository.

Alok Mehta and Ricardo Rodriguez

MSDN Magazine May 2003

how to create XML Schema Collection for SQL 2005

I am generating below schema at run time in C#, Is there any way to create a XML Schema in SQL 2005 for this run time generated schema??? <?xml version="1.0" encoding="utf-16"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Address"> <xs:complexType> <xs:sequence> <xs:element name="Name" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>

Dynamically Drop and Create tables, overcoming 4000 charachter limit

We have a Navision SQL-server database for 7 companies. Each table starts with the name of the company. Except for the CompanyName-part, the tables names are equal. I made a Foreach loop that dynamically transfers tables/data from the the Navision-database to a staging-database. I also want to Drop and re-Create the tables dynamically. However, if I try to do that via an expression in a SQL Task, SSIS complains about the 4000 character limit. What is a better way to do this? I want to execute SQL-commands and have SSIS replace part of the tablename with the contents of a variable (being the name of one the 7 companies). I have no access to the Management Studio or the DB so I need it to be done within the package. What is the best way to do that?

How to create a SSIS package to import records form SQl Server 2008 tables to text files

I am a newbie to SSIS and would like to create a package to accomplish the task referenced in the above title. Will appreciate any links and pointers in the right direction.   Thanksakoranteng

SharePoint 2010 + RBS.msi does not create tables ("mssqlrbs") at the content DB

Installed on W2K8 SP2 + SQL 2 K 8 R2 CTP November + SPS2010 beta. SQL instance by default MSSQLSERVER and WSS_Content default content database. Step by step following installation and use of remote Blob Storage capacity documentation:http://technet.microsoft.com/en-us/library/ee748631(office.14).aspxThe RBS.msi, at the log file component installation it seems that installation is correct, but displays the error:... Executing op: ActionStart(Name=FixFilestreamStoreConfig,,)Información 2769. El instalador ha encontrado un error inesperado. El código de error es 2769. La acción personalizada CreateFilesNoUI no ha cerrado 21 identificadores MSIHANDLE.... Executing op: CustomActionSchedule(Action=FixFilestreamStoreConfig, ActionType=3070, Source=BinaryData, Target=RepairProvider, CustomActionData=filestream;C:\Program Files\Microsoft SQL Remote Blob Storage10.50\Provider Libraries\Filestream Provider\FilestreamProviderConfiguration.xml)...The content database have not created the necessary tables "mssqlrbs" and running the command in the SharePoint Shell: $ rbss.Installed () returns "False" I have not found a walkarround or anything let me to implement tables and simulate the installation that performs the .msi, provided in the Feature Pack for Microsoft ® SQL Server ® 2008 R2 November Community Technology Preview (CTP)Any h

create procedure [User_Name].sp_myprocedure. Error since I use dbo schema

I am developing with VS2010. When I generate a store procedure (DATASET>RIGHT CLICK ADD>SELECT>NEW STORE PROCEDURE) for a data table of a dataset from VS2010, the enviroment generates this: IF EXISTS (SELECT * FROM sysobjects WHERE name = 'SelectQuery' AND user_name(uid) = 'DOMAIN\USER-LOGIN')  DROP PROCEDURE [DOMAIN\USER-LOGIN'].SelectQuery GO CREATE PROCEDURE [DOMAIN\USER-LOGIN'].SelectQuery AS  SET NOCOUNT ON; SELECT contract_id, product_id, contract_description FROM dbo.TContracts GO The creation of the procedure ends with erros since my schema is dbo. So far, I work around copying and pasting the store procedure changing the schema and starting again from the beginning: DATASET>RIGHT CLICK ADD>SELECT>FROM EXISTING STORE PROCEDURE. Is there any way to configure VS2100 to generate the scripts avoinding to prefix the supposed schema of my user. Many thanks.

Create view that amins to tables of another database on the same sql server instance

Hi to everybody, I found a situation ever met before. I develop on Dynamics NAV 5.01 and I have developed a method to be able to see some particular tables of an external database. In substance it deals with a property of tables of Dynamics NAV. When I create a table in NAV, I can create it in 3 different ways: table common to all the companies table  for company or table linked to a view.    This last case is mine, on the same db of NAV I have created a view with some fields, I have created in NAV a table linked with equal fields and types. Until here all normal.    The view, however, aims to another database that doesn't center anything with NAV but that it is on the same intance of SQL server.    The consumer that accesses NAV is a consumer type database SQL Server and has the permitted db_public and db_datareader on both the database. Then he can read the views on the db of nav both on the db of the other database.    When it tries to enter from the console of sql server, with the consumer database, all it works, if I do it by NAV, it show me an error "The server principal "username" is not able to access the database "some_database_name" under the current security context. (Microsoft SQL Server, Error: 916) "    If I add on the database NAV to the consumer, the role db_owner,

how do i create a schema.ini file from a tab delimited file?

Hi there,How do I create a schema.ini file from a tab delimited file?I have this so far:[myFile.txt]ColNameHeader=TrueFormat=TabDelimitedCharacterSet=ANSII think I need something like this after my last line from above:Col1=first TEXT width 150My text file has 7 columns, the first row is the header row. The data comes from a Micosoft SQL Server Database where the fields are of the following types:intnvarchar(MAX)nvarchar(50)Many many thanks,Kiley

Please help to create XML mapping schema for bulk load

Hi all I have XML file <?xml version="1.0" encoding="UTF-8" ?> - <env:ContentEnvelope xmlns="http://???.com/metadata/2009-09-01/" xmlns:env="http://???.com/Envelope/2008-05-01/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" pubStyle="FullRebuild" majVers="1" minVers="0.0"> - <env:Header> - <env:Info> <env:Id>33f49efd-4f7a-4e60-a00f-480edb298e4b</env:Id> <env:TimeStamp>2010-09-14T00:00:39.156</env:TimeStamp> </env:Info> </env:Header> - <env:Body contentSet="MetadataSystems" majVers="1" minVers="0.0"> - <env:ContentItem action="Insert"> - <env:Data xsi:type="CommodityItem"> - <Commodity activeFrom="1900-01-01T00:00:00"> <CommodityId>300007</CommodityId> <CommodityUniqueName>Acid Oils</CommodityUniqueName> <CommodityName effectiveFrom="1900-01-01T00:00:00" commodityNameType="404502" language="505074" commodityNameMetadataViewId="404300" commodityNameSequence="1">Acidic oils- an agricultural commodity</CommodityName> <CommodityName effectiveFrom="1900-01-01T00:00:00" commodityNameType="404500" language="505074" commodityNameMetadat

How do I create a query that joins two tables and returns a single entry with the most recent update


Say I have the following two tables (Purchase & Customer). 

CustomerID StoreName PurchaseDate
1 Asheville 9/14/2010 15:49

Offshore Host Renames Tables with Schema Name on Restore


I was so happy today when I checked a site that gets a lot of user submitted content and realized that I had been able to grab my database from my US hosting company, send it overseas, and get it restored without any new UGC to copy over. Then I realized that all of my queries were broken and after some trouble shooting I realized that all of my tables that were not part of the (dbo) schema were renamed in server explorer to include the name (defautschema) which would require the renaming of my queries to specify defaultschema.tablename on all non (dbo) schema tables.

The first thing I tried to do was right click on the names of the tables and select rename to delete them right there in Server Exporer, but no such option exists. Then I followed the directions for renaming tables, but the table names in the table definition do not include the schema names. I also tried deleting the schema, but got an error message saying that I have to have a schema.

Is there any way for me to change the names of the tables so that I don't have to add "schemaname." to every single column name in ever query that I have ever written?

How do I create a schema, and a table in that schema?


Using SQL Server Management Studio, how do I create a schema, and then create a table owned by that schema? I need to do this for Sql Server 2000, 2005, & 2008 (for unit tests).

thanks - dave

Very funny video - Reporting as a Metaphor

Hiding Schema of Specific Tables


We are launching one of our products as Packaged Product or Commercial Off The Shelf (COTS) software. The software manages business data as well as application specific data into tables of SQL Server database.

When a client will install the project the schema will be copied to his machine's SQL Server, however i was wondering if i can prevent the client from viewing the schema and data of application specific tables.

These tables however should still be available to the application itself.

Can I create multiple report tables from one Dataset?


I'm producing a report in Report Builder 3.0 that needs to show events grouped by time of day, and another table with the same data grouped by day of week. Both tables show the same results, just grouped differently. The query that generates the ungrouped data is expensive, so I don't want to run it twice.

I've created queries in Management Studio that get the ungrouped data into a global temp table, and then I can fetch both grouped data sets from there. Unfortunately I can't get this to work in Report Builder. I have one Dataset that runs the main query, saves it into global temp, and then returns the first result set. The second Dataset returns the results from global temp. This keeps failing, the second result set is blank.

Does Reporting services run the queries in the order they are in the report, or are they run concurrently? If they are run concurrently this would explain it. Is there anything I can do to change this so that the second query doesn't run until the first one has completed?

Is there a better way of achieving the results I'm after?

how to stop ScriptTransfer from generate "Create User" "Create Schema" sql statement?



I am using the following code to generate scripts, but no matter how i configure the options, it always generate create user statement




// Connection to Server
        Server srv = new Server(ConfigurationManager.AppSettings["Server"]);

        srv.ConnectionContext.LoginSecure = false;

Problem with create ActionResults using 2 tables


I have a create actionlink the data that I'm adding belong to table name

One of the fields (name company_Id), is connect to table name company,(one2many
table),  So, if I'm trying to write data that already exist
in the company table , the model is invalid ,

Ne w company name,it is valid, how can write a new data entry and still
use the company table existing data entry

I'm adding my code so mybe my Q. will be more understandable ,


public  interface Irepository
       IEnumerable<company> list1();

       IEnumerable<cosmetic> list();
       cosmetic Get(int id);
       void Create(cosmetic cosmeticToCreate, company conpanyToCreate);
       void Edit(cosmetic cosmeticToEdit);
       void Delete(cosmetic cosmetToDelete);

//the class
 public class CompanyRepository :Irepository
        SR_1Entities _entitiy = new SR_1E

How to create buckets on measures from 2 fact tables, i.e variance between actual and budget coming


1. to put the gist of the problem, i am trying to make an expense analysis report that compares my actual with its budget.

2. actual is coming from 1 fact table e.g. fact_general_ledger (grain = voucher number) and budget is coming from another fact table (grain = account [much higher than voucher number])

3. i have to calculate the variance (actual minus budget) at an account grain and make a percentage measure. hence i will get data like

Account     Var%

a1             -115%

a2              -5%

a3              7%

a4              20%

a5              22%

a6              35%

a7              45%

a8              57%

a9              95%

a10      &

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend