Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Script SQL Table Schema as XML-XSD Expand / Collapse
Author
Message
Posted Thursday, October 8, 2009 4:12 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, October 23, 2014 1:54 PM
Points: 68, Visits: 376
Comments posted to this topic are about the item Script SQL Table Schema as XML-XSD
Post #799844
Posted Wednesday, October 28, 2009 10:03 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 20, 2009 7:43 AM
Points: 1, Visits: 7
Just a note, you can change the element names if necessary for obfuscation with aliases as well, for example:

SELECT TOP 0 [ID] = MemberAddrID
, [Address1] = Addr1
, [Address2] = Addr2
, [Address3] = Addr3
, [City]
, [State] = ST
, [Zipcode] = Zipcode
FROM dbo.MBR_ADDR AS [MEMBER_ADDRESS]
FOR XML AUTO, XMLSCHEMA;

You're not locked into just following table's structure, you can do this on views as well, nice to see this article since its something that a lot of people don't know about or don't think regularly about.
Post #810097
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse