Drop 메서드
데이터베이스에서 테이블을 제거합니다.
네임스페이스: Microsoft.SqlServer.Management.Smo
어셈블리: Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)
구문
‘선언
Public Sub Drop
‘사용 방법
Dim instance As Table
instance.Drop()
public void Drop()
public:
virtual void Drop() sealed
abstract Drop : unit -> unit
override Drop : unit -> unit
public final function Drop()
구현
예
The following code example shows how to create, and then drop a table.
C#
Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2008R2"];
Table tb = new Table(db, "Test Table");
Column col1 = new Column(tb, "Name", DataType.NChar(50));
Column col2 = new Column(tb, "ID", DataType.Int);
tb.Columns.Add(col1);
tb.Columns.Add(col2);
tb.Create();
tb.Drop();
Powershell
#Connect to the local server and get the AdventureWorks2008R2 database
$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2008R2")
#Create the Table
$tb = new-object Microsoft.SqlServer.Management.Smo.Table($db, "Test Table")
$col1 = new-object Microsoft.SqlServer.Management.Smo.Column($tb, "Name", [Microsoft.SqlServer.Management.Smo.DataType]::NChar(50))
$col2 = new-object Microsoft.SqlServer.Management.Smo.Column($tb, "ID", [Microsoft.SqlServer.Management.Smo.DataType]::Int)
$tb.Columns.Add($col1)
$tb.Columns.Add($col2)
$tb.Create()
$tb.Drop()