Database.Alter Database.Alter Database.Alter Method

Definition

Updates any Database object property changes on an instance of SQL Server.

Overloads

Alter() Alter() Alter()

Updates any Database object property changes on the instance of SQL Server.

Alter(TerminationClause) Alter(TerminationClause)

Updates any Database object property changes on the instance of SQL Server.

Alter(TimeSpan) Alter(TimeSpan) Alter(TimeSpan)

Updates any Database object property changes on the instance of SQL Server.

Alter() Alter() Alter()

Updates any Database object property changes on the instance of SQL Server.

public:
 virtual void Alter();
public void Alter ();
Public Sub Alter ()

Examples

VB

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$db = New-Object Microsoft.SqlServer.Management.Smo.Database($srv, "Test_SMO_Database")  
$db.Create()  
Write-Host $db.CreateDate  
$db.Drop()  

Remarks

The Alter method updates any changes that have been made to the properties of the Database object since the Database object was created or since the last Alter statement. The modifications are combined and sent to the instance of SQL Server in a single network trip to the instance of SQL Server.

Alter(TerminationClause) Alter(TerminationClause)

Updates any Database object property changes on the instance of SQL Server.

public:
 void Alter(Microsoft::SqlServer::Management::Smo::TerminationClause terminationClause);
public void Alter (Microsoft.SqlServer.Management.Smo.TerminationClause terminationClause);
Parameters
terminationClause
TerminationClause TerminationClause TerminationClause

A TerminationClause object value that specifies any open transactions that are affected by the Alter(TerminationClause) method.

Examples

VB

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$db = New-Object Microsoft.SqlServer.Management.Smo.Database($srv, "Test_SMO_Database")  
$db.Create()  
Write-Host $db.CreateDate  
$db.Drop()  

Remarks

The Alter method updates any changes that have been made to the properties of the Database object since the Database object was created or since the last Alter statement. The modifications are combined and sent to the instance of SQL Server in a single network trip.

Alter(TimeSpan) Alter(TimeSpan) Alter(TimeSpan)

Updates any Database object property changes on the instance of SQL Server.

public:
 void Alter(TimeSpan transactionTerminationTime);
public void Alter (TimeSpan transactionTerminationTime);
Public Sub Alter (transactionTerminationTime As TimeSpan)
Parameters
transactionTerminationTime
TimeSpan TimeSpan TimeSpan

A TimeSpan object value that specifies a period of time to let transactions complete before persisting the property changes with the Alter() method.

Examples

VB

PowerShell

$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")  
$db = New-Object Microsoft.SqlServer.Management.Smo.Database($srv, "Test_SMO_Database")  
$db.Create()  
Write-Host $db.CreateDate  
$db.Drop()  

Remarks

The Alter method updates any changes that have been made to the properties of the Database object since the Database object was created or since the last Alter statement. The modifications are combined and sent to the instance of SQL Server in a single network trip.

Applies to