SQL-DMO Script entire database???

SQL-DMO Script entire database???

Post by Sean Jackso » Fri, 09 Mar 2001 07:45:44



In EM I can script an entire database.  However I need to do that in a
Stored Procedure.
Being a newbie to DMO i'm not sure how to acheive this.

Has any body done this???

 
 
 

SQL-DMO Script entire database???

Post by DineshT » Fri, 09 Mar 2001 07:54:29


Hi Sean,
Look into script method in SQL-DMO

Though I have not tried this.

Dinesh.

 
 
 

SQL-DMO Script entire database???

Post by Tibor Karasz » Sat, 10 Mar 2001 21:49:14


Here's something I did a long time ago...

Dim oSS As SQLDMO.SQLServer
Dim oDb As SQLDMO.Database
Dim oT As SQLDMO.Transfer
Dim sS As String
Sub Script()
    Set oSS = New SQLDMO.SQLServer
    Set oT = New SQLDMO.Transfer
    oSS.Connect "server", "user", "password"  'Connect to the server
    Set oDb = oSS.Databases("pubs")           'Use a DB
    oT.CopyAllTables = True
    oDb.ScriptTransfer oT, SQLDMOXfrFile_SingleFile, "C:\pubs.sql"
End Sub

--
Tibor Karaszi, SQL Server MVP
FAQ from Neil at: http://www.sqlserverfaq.com
Please reply to the newsgroup only, not by email.


> Hi Sean,
> Look into script method in SQL-DMO

> Though I have not tried this.

> Dinesh.