Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Script SQL Table Schema as XML-XSD

By Banyardi Schmardi,

I was creating a Proof of Concept (POC) for using Service Broker (SB) to synchronize databases across an untrusted domain boundry. I wanted to validate my XML SB messages using an XSD based on the table definition. I first approached the problem from the standpoint of using VS2008 database edition, but then I found a simpler method by using the SELECT statement with the FOR XML clause. By adding the XMLSCHEMA qualifier the XML Schema definition is added to the payload, but because that's all I want I simply use the TOP 0 clause to suppress any actual data.

Total article views: 1248 | Views in the last 30 days: 4
 
Tags
sql schema    
xml    
xsd    
 
Contribute