Generating an XML Schema of SQL Server 2005 Database
I was told to generate an XML Schema of an SQL Server 2005 Database. And naturally I started googling it out so I found this at a blog given by the URL at the bottom.
Thumbs up to ya my friend!
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:
http://dwightrau.blogspot.com/2008/02/generate-or-create-xsd-schema-from.html

