SYSK 247: Generate BizTalk XSD from SQL Server Generated XML

1.) Use the “FOR XML AUTO, ELEMENTS” syntax. You can use joins for any relationships.

For Example:

                SELECT * FROM Table1 ON LEFT OUTER JOIN Table2

                                ON Table1.pk_id = Table2.fk_id

                FOR XML AUTO, ELEMENTS

 

2.) Copy and paste the resulting text into Notepad and save as an xml file.

 

3.) From a BizTalk Project in Visual Studio, do the following:

a. Right-click on Project and click “Add Generated Items…”

b. Pick “Generate Schemas” and then click “Add”.

c. Select “Well-Formed XML” as a Document Type.

d. Browse to the XML file as an Input file.

e. Click OK.

 

Special thanks to John Livingston for this information.