次の方法で共有


Database.Alter メソッド (TerminationClause)

SQL Server のインスタンスの Database オブジェクトのプロパティに対する変更をすべて更新します。 

名前空間:  Microsoft.SqlServer.Management.Smo
アセンブリ:  Microsoft.SqlServer.Smo (Microsoft.SqlServer.Smo.dll)

構文

'宣言
Public Sub Alter ( _
    terminationClause As TerminationClause _
)
'使用
Dim instance As Database 
Dim terminationClause As TerminationClause

instance.Alter(terminationClause)
public void Alter(
    TerminationClause terminationClause
)
public:
void Alter(
    TerminationClause terminationClause
)
member Alter : 
        terminationClause:TerminationClause -> unit
public function Alter(
    terminationClause : TerminationClause
)

パラメーター

説明

Alter メソッドは、Database オブジェクトの作成後、または最後の Alter ステートメントの後に Database オブジェクトのプロパティに対して行われたすべての変更を更新します。 変更が結合され、1 回のネットワーク トリップで SQL Server のインスタンスに送信されます。

使用例

VB

'Connect to the local, default instance of SQL Server.
Dim srv As Server
srv = New Server
'Define a Database object variable by supplying the server and the database name arguments in the constructor.
Dim db As Database
db = New Database(srv, "Test_SMO_Database")
'Create the database on the instance of SQL Server.
db.Create()
'Reference the database and display the date when it was created.
db = srv.Databases("Test_SMO_Database")
Console.WriteLine(db.CreateDate)
'Remove the database.
db.Drop()

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()

関連項目

参照

Database クラス

Alter オーバーロード

Microsoft.SqlServer.Management.Smo 名前空間

その他の技術情報

データベース オブジェクトでの作業

データベースの作成、変更、および削除

ALTER DATABASE (Transact-SQL)