Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Posts
    22

    Question Unanswered: Views and ScriptTransfer method (DMO)

    I`m using object Database`s method SQLDMO.Transfer for script db objects (with SQLDMO). I create special folder for ex."tables" and script each table inside (.CopyAllTables = True). No more objects created in this folder besides tables. But when i try to script views

    Set dmoSQLServer = CreateObject("SQLDMO.SQLServer")
    dmoSQLServer.Connect "MySrvName", "sa", ""

    Set dmoTransfer = CreateObject("SQLDMO.Transfer")
    dmoTransfer.CopyAllViews = True
    dmoTransfer.ScriptType = ?????????????
    dmoSQLServer.Databases(MyDBName).ScriptTransfer dmoTransfer,4, "C:\Views"

    in this folder appear scripts for all views and ALL TABLES! How can i deliver from table scripts? What ScriptType value can help me?

    ps of course i can use method .Script instead of .ScriptTransfer and use one of the Microsoft examples, but IMHO .ScriptTransfer method is much more handy

    Thanks

  2. #2
    Join Date
    Sep 2003
    Posts
    364
    Here's a script I use. It can script all db objects you supply the type wanted.
    Attached Files Attached Files

  3. #3
    Join Date
    Apr 2004
    Posts
    22

    Unhappy SQLDMO.Transfer method scripttype for views

    Thanx peterlemonjello, but i want to use <ScriptTransfer> method with object Transfer ...
    I have something like yours variant with <Script> method. As well your wouldn`t script system tables, you can add to your script something like that:

    FOR EACH oTbl IN oDatabase.Tables
    If oTbl.SystemObject = False Then ...........

    And if yours sqlserver have name like "MyComp\MySqlServer" directory in yours script not created.

    Thanx

  4. #4
    Join Date
    Apr 2004
    Posts
    22

    Cool Views and ScriptTransfer method (DMO)

    2 peterlemonjello
    sorry, you using this If oTbl.SystemObject = False Then ...........

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •