共用方式為


ReplicationServer.CopySubscriptionDatabase 方法

Copies an existing pull subscription database.

命名空間:  Microsoft.SqlServer.Replication
組件:  Microsoft.SqlServer.Rmo (在 Microsoft.SqlServer.Rmo.dll 中)

語法

'宣告
Public Sub CopySubscriptionDatabase ( _
    databaseName As String, _
    fileName As String, _
    overwriteExistingFile As Boolean _
)
'用途
Dim instance As ReplicationServer 
Dim databaseName As String 
Dim fileName As String 
Dim overwriteExistingFile As Boolean

instance.CopySubscriptionDatabase(databaseName, _
    fileName, overwriteExistingFile)
public void CopySubscriptionDatabase(
    string databaseName,
    string fileName,
    bool overwriteExistingFile
)
public:
void CopySubscriptionDatabase(
    String^ databaseName, 
    String^ fileName, 
    bool overwriteExistingFile
)
member CopySubscriptionDatabase : 
        databaseName:string * 
        fileName:string * 
        overwriteExistingFile:bool -> unit
public function CopySubscriptionDatabase(
    databaseName : String, 
    fileName : String, 
    overwriteExistingFile : boolean
)

參數

  • databaseName
    型別:System.String
    A string value that specifies the name of a pull subscription database to copy.
  • fileName
    型別:System.String
    A string value that specifies the complete path, including file name, to which a copy of the data portion (.mdf) file is saved.
  • overwriteExistingFile
    型別:System.Boolean
    A Boolean value that specifies whether or not to overwrite an existing file of the same name specified in the fileName parameter, if there is one.

例外狀況

例外狀況 條件
ApplicationException

When the server is not running on Microsoft SQL Server 2000 or later.

ArgumentException

If a parameter is null, contains null characters, or exceeds 128 bytes.

備註

[!附註]

未來的 Microsoft SQL Server 版本將移除這項功能。請勿在新的開發工作中使用此功能,並且儘速修改使用此功能的應用程式。

Only single file databases can be copied.

The CopySubscriptionDatabase method can be called by a member of the db_owner fixed database role of the database that is being copied.

The CopySubscriptionDatabase method is equivalent to the sp_copysubscription (Transact-SQL) stored procedure.

請參閱

參考

ReplicationServer 類別

Microsoft.SqlServer.Replication 命名空間