Skip to content Skip to sidebar Skip to footer

Sql Server Parallels To Oracle Dbms_metadata.get_ddl?

I'm looking for command line or scripted solutions to pull the DDL out of SQL Server 2005+ for all database objects: tables, stored procs, views, indices/indexes, constraints, etc.

Solution 1:

There is no support in the Transact-SQL language. The client libraries (SMO) can do it using a Scripter object, see example at http://msdn.microsoft.com/en-us/library/ms162153.aspx. You can use SMO from PowerShell as a scripted solution.

The SQL Management Studio also has an option (right click on a database, go to Tasks, select Generate Scripts), it uses an SMO Scripter under the covers.

Solution 2:

I wrote SMOscript, a command-line tool which uses SMO to generate DDL files of all database objects.

Post a Comment for "Sql Server Parallels To Oracle Dbms_metadata.get_ddl?"