SQLDMO

  • I am trying to create an interface for transferring tables from one database to another database.

    When I use the script method of the sqldmo object to get the script for the table it does not concatenate the schema owner name. This creates a problem, as there can be two tables with the same name owned by two different users.

    Any Suggestions how to go about this?

    Pay Respect to People on your way up. For you will meet the same People on your way down.


    He who knows others is learned but the wise one is one who knows himself.

  • This was removed by the editor as SPAM

  • Replace(objTable.Script, "CREATE TABLE [", "CREATE TABLE [" & objTable.Owner & "].[")

    --Jonathan



    --Jonathan

  • You need to pass the value 262144 (SQLDMOScript_OwnerQualify) in scripttype. See "Script Method (Table Object)" in BOL.

    A T-SQL example is:

     
    
    DECLARE @ScriptType BIGINT
    SET @ScriptType = 2 | 4 | 262144
    EXEC sp_OAMethod @table, 'Script', NULL, @ScriptType

    Cheers,

    - Mark


    Cheers,
    - Mark

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply