Eksempel inspireret af VB klassen TransferEvent.cls
af Gert E.R. Drapers (gertd@sqldev.net) 2003-07-29:
Dim objTransfer
Set objTransfer = CreateObject( "SQLDMO.Transfer2" )
With objTransfer
.DestServer = "SERVER02\INSTANCE01"
.DestDatabase = "DDBA0T_TransferTest"
.DestUseTrustedConnection = True
.CopySchema = True
.CopyAllObjects = True
.CopyAllDefaults = True
.CopyAllFunctions = True
.CopyAllRules = True
.CopyAllStoredProcedures = True
.CopyAllTables = True
.CopyAllTriggers = True
.CopyAllUserDefinedDatatypes = True
.CopyAllViews = True
.CopyData = SQLDMOCopyData_Replace
.DropDestObjectsFirst = True
.IncludeDependencies = True
.IncludeDB = True
'.IncludeLogins = True
.IncludeUsers = True
.ScriptType = SQLDMOScript_Default
.Script2Type = SQLDMOScript2_Default
.SourceTranslateChar = False
.UseCollation = False
.UseDestTransaction = False
End With 'objTransfer
Dim objSourceInstance
Set objSourceInstance = CreateObject( "SQLDMO.SQLServer2" )
objSourceInstance.LoginSecure = True
objSourceInstance.Connect( "SERVER01\INSTANCE01" )
Dim objDatabase
Set objDatabase = objSourceInstance.Databases( "DDBA0P_TransferTest" )
objDatabase.Transfer( objTransfer )
objSourceInstance.DisConnect
Set objDatabase = Nothing
Set objTransfer = Nothing
Set objSourceInstance = Nothing
Se også:
SQLDMO.Transfer2