Wednesday, February 13, 2008

Generate or create XSD Schema from Database Table in sql server 2005

create table Person
(
Age int not NULL check( Age > 0) ,
Height numeric(10,2) not NULL check( Height > 5),
Gender varchar(5) not null check( Gender in ('M', 'F', 'O')),
BirthDate datetime null,
)
DECLARE @schema xml
SET @schema = (SELECT * FROM Person FOR XML AUTO, ELEMENTS, XMLSCHEMA('PersonSchema'))
select @schema
OUTPUT:

5 Comments:

At 8:17 AM, Blogger Imran Akram said...

That's a very helpful post my friend, thanks a lot. I gained something from it

God Bless!

 
At 2:34 PM, Anonymous Anonymous said...

The reverse

http://xml2ddl.berlios.de/

 
At 2:14 PM, Blogger Unknown said...

Any tips on doing this on an entire database resulting in one XSD file?

 
At 2:59 AM, Blogger stafford said...

alo interested in something that will generate for the entire database schema, rather than just a table...cheers.

 
At 1:57 AM, Anonymous Cheap WOW Gold said...

Eden Eternal
Eden Eternal Gold
Eden Eternal Review

 

Post a Comment

<< Home