Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ReplaceDatabase Property

Restore.ReplaceDatabase Property

Gets or sets a Boolean value that specifies whether a restore operation creates a new image of the restored database.

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

function get ReplaceDatabase () : boolean 
function set ReplaceDatabase (value : boolean)

Property Value

Type: Boolean
A Boolean value that specifies whether a new image of the restored database will be created.If True, a new image of the database is created. The image is created regardless of the presence of an existing database with the same name.If False (default), a new image of the database is not created by the restore operation. The database that is targeted by the restore operation must exist on an instance of SQL Server.

The following code example sets the restore operation to create a new image of the restored database.

VB

Dim rs As Restore
rs = New Restore
rs.ReplaceDatabase = true

PowerShell

$rs = new-object Microsoft.SqlServer.Management.Smo.Restore
$rs.ReplaceDatabast = $TRUE

Community Additions

ADD
Show:
© 2015 Microsoft