views:

289

answers:

2

This is something I know can be done somehow, because I've done it before, but I can't for the life of me remember how.

I want to export the structure of an SQL Server database to an XML file. The one that I have from last time we did this has this kind of structure:

<Data>
    <Details>
        <Server>Server Name</Server>
        <Database>Database Name</Database>
    </Details>
    <Tables>
        <Table>
            <Name>Table Name</Name>
            <Columns>
                <Column>
                    <Colname>Column Name</Colname>
                </Column>
            </Columns>
        </Table>
    </Tables>
    <Procedures>
        <Procedure>
            <Name>Procedure Name</name>
            <Definition>Full text of script</Definition>
        </Procedure>
    </Procedures>
</Data>

...And so on. Does anyone know where to find this option?

+2  A: 

DatabaseSpy can do this and has a 30-day trial.

Per comment: You might be able to do it with SSIS and you could certainly do it with some FOR XML queries against the system tables.

JP Alioto
Margaret
+2  A: 

Aha. It wasn't a built in feature after all - we use SQL Delta (http://www.sqldelta.com/), and its "Snapshot" feature was what was used.

Margaret