Delen via


Transfer Class

The Transfer object is a tool object that provides programmatic control over copying of schemas and data to other instances of SQL Server.

Inheritance Hierarchy

System.Object
  Microsoft.SqlServer.Management.Smo.Transfer

Namespace:  Microsoft.SqlServer.Management.Smo
Assembly:  Microsoft.SqlServer.SmoExtended (in Microsoft.SqlServer.SmoExtended.dll)

Syntax

'Declaration
Public Class Transfer _
    Implements ITransferMetadataProvider
'Usage
Dim instance As Transfer
public class Transfer : ITransferMetadataProvider
public ref class Transfer : ITransferMetadataProvider
type Transfer =  
    class
        interface ITransferMetadataProvider
    end
public class Transfer implements ITransferMetadataProvider

The Transfer type exposes the following members.

Constructors

  Name Description
Public method Transfer() Initializes a new instance of the Transfer class.
Public method Transfer(Database) Initializes a new instance of the Transfer class that uses the specified database as the source of the transfer operation.

Top

Properties

  Name Description
Public property CopyAllDatabaseTriggers Gets or sets the Boolean property value that specifies whether all the SQL Server database triggers are copied from the source database to the target database in the transfer operation.
Public property CopyAllDefaults Gets or sets the Boolean property value that specifies whether all the SQL Server defaults are copied from the source database to the target database in the transfer operation.
Public property CopyAllFullTextCatalogs Gets or sets the Boolean property value that specifies whether all the SQL Server Full-Text catalogs are copied from the source database to the target database in the transfer operation.
Public property CopyAllFullTextStopLists Gets or sets the Boolean property value that specifies whether all the SQL Server full-text stop lists are copied from the source database to the target database in the transfer operation.
Public property CopyAllLogins Gets or sets the Boolean property value that specifies whether all the SQL Server logins are copied from the source database to the target database in the transfer operation.
Public property CopyAllObjects Gets or sets the Boolean property value that specifies whether all the SQL Server objects are copied from the source database to the target database in the transfer operation.
Public property CopyAllPartitionFunctions Gets or sets the Boolean property value that specifies whether all the SQL Server partition functions are copied from the source database to the target database in the transfer operation.
Public property CopyAllPartitionSchemes Gets or sets the Boolean property value that specifies whether all the SQL Server partition schemes are copied from the source database to the target database in the transfer operation.
Public property CopyAllPlanGuides Gets or sets the Boolean property value that specifies whether all the SQL Server plan guides are copied from the source database to the target database in the transfer operation.
Public property CopyAllRoles Gets or sets the Boolean property value that specifies whether all the SQL Server roles are copied from the source database to the target database in the transfer operation.
Public property CopyAllRules Gets or sets the Boolean property value that specifies whether all the SQL Server rules are copied from the source database to the target database in the transfer operation.
Public property CopyAllSchemas Gets or sets the Boolean property value that specifies whether all the SQL Server schemas are copied from the source database to the target database in the transfer operation.
Public property CopyAllSqlAssemblies Gets or sets the Boolean property value that specifies whether all the SQL Server assemblies are copied from the source database to the target database in the transfer operation.
Public property CopyAllStoredProcedures Gets or sets the Boolean property value that specifies whether all the SQL Server stored procedures are copied from the source database to the target database in the transfer operation.
Public property CopyAllSynonyms Gets or sets the Boolean property value that specifies whether all the SQL Server synonyms are copied from the source database to the target database in the transfer operation.
Public property CopyAllTables Gets or sets the Boolean property value that specifies whether all the SQL Server tables are copied from the source database to the target database in the transfer operation.
Public property CopyAllUserDefinedAggregates Gets or sets the Boolean property value that specifies whether all the SQL Server user-defined aggregates are copied from the source database to the target database in the transfer operation.
Public property CopyAllUserDefinedDataTypes Gets or sets the Boolean property value that specifies whether all the SQL Server user-defined data types are copied from the source database to the target database in the transfer operation.
Public property CopyAllUserDefinedFunctions Gets or sets the Boolean property value that specifies whether all the SQL Server user-defined functions are copied from the source database to the target database in the transfer operation.
Public property CopyAllUserDefinedTableTypes Gets or sets the Boolean property value that specifies whether all the SQL Server user-defined table types are copied from the source database to the target database in the transfer operation.
Public property CopyAllUserDefinedTypes Gets or sets the Boolean property value that specifies whether all the SQL Server user-defined types are copied from the source database to the target database in the transfer operation.
Public property CopyAllUsers Gets or sets the Boolean property value that specifies whether all the SQL Server database users are copied from the source database to the target database in the transfer operation.
Public property CopyAllViews Gets or sets the Boolean property value that specifies whether all the SQL Server views are copied from the source database to the target database in the transfer operation.
Public property CopyAllXmlSchemaCollections Gets or sets the Boolean property value that specifies whether all the SQL Server XML schema collections are copied from the source database to the target database in the transfer operation.
Public property CopyData Gets or sets the Boolean property value that specifies whether all the data is copied from the source database to the target database in the transfer operation.
Public property CopySchema Gets or sets the Boolean property value that specifies whether the schema is copied from the source database to the target database in the transfer operation.
Public property CreateTargetDatabase Gets or sets the Boolean property value that specifies whether the target database is created in the transfer operation.
Public property Database Gets or sets the database from which schema or data is to be transferred to the target location.
Public property DatabaseFileMappings Gets or sets properties that are associated with flat file destination based on a DatabaseFileMappingsDictionary object.
Public property DestinationDatabase Gets or sets the database that is the destination of the transfer operation.
Public property DestinationLogin Gets or sets the logon for the instance of SQL Server to which the destination database belongs.
Public property DestinationLoginSecure Gets or sets the Boolean property that specifies whether the instance of SQL Server that contains the destination database is enabled for Windows Authentication or not.
Public property DestinationPassword Gets or sets the logon password for the instance of SQL Server to which the destination database belongs.
Public property DestinationServer Gets or sets the instance of SQL Server that owns the database that is the destination of the transfer operation.
Public property DestinationTranslateChar Gets or sets the Boolean property value that specifies whether the transfer operation translates the code page for characters on the destination database.
Public property DropDestinationObjectsFirst Gets or sets the Boolean property value that specifies whether to drop the objects in the destination database before the transfer operation.
Public property ObjectList Gets or sets the objects copied from the source to destination in the transfer operation.
Public property Options Gets or sets the options for the transfer operation.
Public property PrefetchObjects Gets or sets the Boolean property that specifies whether to prefetch the objects before the transfer operation.
Public property PreserveDbo Gets or sets a Boolean value that specifies whether DBO ownerships are retained through the transfer process.
Public property PreserveLogins Gets or sets the Boolean property that specifies whether to preserve logins in the transfer operation.
Public property SourceTranslateChar Gets or sets the Boolean property value that specifies whether the transfer operation translates the code page for characters on the source database.
Public property TargetDatabaseFilePath Gets or sets the path to where the database files will be copied.
Public property TargetLogFilePath Gets or sets the path to where the database files will be copied.
Public property TemporaryPackageDirectory Gets or sets the file location for storage of temporary packages created during the transfer operation.
Public property UseDestinationTransaction Gets or sets the Boolean property value that specifies whether to use the destination transaction.

Top

Methods

  Name Description
Public method EnumObjects Returns an enumerated list of Uniform Resource Name (URN) values that represent the objects included in the transfer operation.
Public method EnumScriptTransfer Creates a Transact-SQL command batch script used to transfer database objects or database objects and data to another database instance.
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetTransferProvider Returns the data transfer provider interface.
Public method GetType (Inherited from Object.)
Protected method MemberwiseClone (Inherited from Object.)
Protected methodStatic member ProcessDependencyChain Returns a URN array with options.
Public method ScriptTransfer Creates a Transact-SQL command batch script that creates database objects that are transferred by the transfer operation.
Public method ToString (Inherited from Object.)
Public method TransferData Transfers data as specified by the Transfer object.

Top

Events

  Name Description
Public event DataTransferEvent Reports that data has been transferred.
Public event DiscoveryProgress Marks the progress of the discovery process.
Public event ScriptingError Reports that an error occurred during the scripting process.
Public event ScriptingProgress Marks the progress of the scripting process.

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method ITransferMetadataProvider.GetOptions The ITransferMetadataProvider class represents an interface that implements the transfer metadata process on the referenced connection.
Explicit interface implemetationPrivate method ITransferMetadataProvider.SaveMetadata Saves metadata when transferring databases across instances.

Top

Remarks

There are some limitations when transferring a database to a server instance that is running SQL Server 2000: 

  • If the database has a schema for which there is no corresponding user on the target SQL Server 2000 server instance, it cannot be transferred. In this case, you have to create a user who has a name that is the same as the name of the schema.

  • Any object that uses the following data types cannot be transferred:

    • SqlDataType.Xml

    • SqlDataType.VarCharMax

    • SqlDataType.NVarCharMax

    • SqlDataType.VarBinaryMax

The following object types cannot be transferred:

  • All broker objects

  • All mail objects

  • Endpoint

  • ServerDdlTrigger

  • ExtendedStoredProcedure

  • FullTextCatalog

  • UserDefinedMessage

  • ApplicationRole

To get and set Transfer object properties, users can be a member of the public fixed server role.

To transfer data, users can be a member of the public fixed server role.

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are safe for multithreaded operations. Any instance members are not guaranteed to be thread safe. 

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.