Hi ,
I’m using following VB script (SMO) to copy tables between instances and it works fine. At the moment
xfr.CopyAllTables = True
but I would like to be able to be selective (list of table) that would be transferred.
Dim svr_connection As ServerConnection = New ServerConnection()
svr_connection.ServerInstance = "TECH-2L56H2J\sql2k5"
'svr_connection.ConnectionString = "Data Source=TECH-907WL2J;Initial Catalog=CustomerDM_Control;Trusted_Connection=true"
Dim dest_svr_connection As ServerConnection = New ServerConnection()
dest_svr_connection.ServerInstance = "TECH-2L56H2J\sql2k5_2"
'dest_svr_connection.ConnectionString = "Data Source=TECH-907WL2J;Initial Catalog=master;Trusted_Connection=true"
Dim srv As Server = New Server(svr_connection)
Dim dest_srv As Server = New Server(dest_svr_connection)
'Reference the source database
Dim db As Database
db = srv.Databases("adventureworks")
'Create a new database that is to be destination database.
Dim dbCopy As Database
dbCopy = New Database(dest_srv, "adventureworkscopy")
dbCopy.Create()
'Define a Transfer object and set the required options and properties.
Dim xfr As Transfer
xfr = New Transfer(db)
xfr.CopyAllTables = True
'xfr.ObjectList.Add("Shaunt")
xfr.DestinationDatabase = "adventureworkscopy"
xfr.DestinationServer = "TECH-2L56H2J\sql2k5_2"
'xfr.DestinationLoginSecure = True
xfr.CopySchema = True
xfr.CopyData = True
xfr.CopySchema = True
xfr.Options.WithDependencies = True
'Script the transfer. Alternatively perform immediate data transfer with TransferData method.
'xfr.ScriptTransfer()
xfr.TransferData()
can you give me any idea?
Thanks
Moving thread...
No comments:
Post a Comment