本文介紹了從 MS SQL 數(shù)據(jù)庫獲取 XML 架構(gòu)的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
限時送ChatGPT賬號..
是否可以使用 .Net 和 C# 以編程方式生成數(shù)據(jù)庫的 XML 模式?我想研究 NDbUnit,但對于大型數(shù)據(jù)庫,手動制作 Schema 真的不可行嗎?
Is it possible to generate a XML Schema of a Database programatically with .Net and C#? I want to look into NDbUnit but for big databases it would not really be feasible to make a Schema manually?
推薦答案
是否可以生成 XML來自數(shù)據(jù)庫的架構(gòu)?
Is it possible to generate a XML Schema from a Database?
確實,XMLSpy 可以從數(shù)據(jù)庫生成 XML Schema.
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
這篇關(guān)于從 MS SQL 數(shù)據(jù)庫獲取 XML 架構(gòu)的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!