SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Script SQL Table Schema as XML-XSD

By Brandon Forest, 2009/10/28

Total article views: 412 | Views in the last 30 days: 404

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.

By Brandon Forest, 2009/10/28

Total article views: 412 | Views in the last 30 days: 404
Your response
 
 
Related tags

SQL Schema    
XML    
XSD    
 
 
Contribute
Like this? Try these...

Extract Objects of a Linked Server

By Sudhir Chawla | Category: Linked Server
(not yet rated) | 377 reads

Free registration required...

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Login (existing users)

Login

Email:   Password:   Remember me: Forgotten your password?

Register (new users)

Register

Email:   Password:
Confirm:

Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

Steve Jones
Editor, SQLServerCentral.com