解决方法
Is it possible to generate a XML
Schema from a Database?
有another way,虽然我从来没有测试过:
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