SQL Server parallels to Oracle DBMS_METADATA.GET_DDL? SQL Server parallels to Oracle DBMS_METADATA.GET_DDL? oracle oracle

SQL Server parallels to Oracle DBMS_METADATA.GET_DDL?


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.


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