Is it possible to generate a XML
Schema from a Database?
It sure is, XMLSpy can generate XML Schema from a database.
There's another way, though I've never tested it:
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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…