Table.ChangeSchema 메서드
Changes the schema on the referenced table.
네임스페이스: Microsoft.SqlServer.Management.Smo
어셈블리: Microsoft.SqlServer.Smo(Microsoft.SqlServer.Smo.dll)
구문
‘선언
Public Sub ChangeSchema ( _
newSchema As String _
)
‘사용 방법
Dim instance As Table
Dim newSchema As String
instance.ChangeSchema(newSchema)
public void ChangeSchema(
string newSchema
)
public:
void ChangeSchema(
String^ newSchema
)
member ChangeSchema :
newSchema:string -> unit
public function ChangeSchema(
newSchema : String
)
매개 변수
- newSchema
유형: System.String
A String value that specifies the new schema.
주의
The table must be created using the Create method before the schema can be changed.
예
The following code example shows how to change the schema of a table.
C#
Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2012"];
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.ChangeSchema("Person");
Powershell
$srv = new-Object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = New-Object Microsoft.SqlServer.Management.Smo.Database
$db = $srv.Databases.Item("AdventureWorks2012")
$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.ChangeSchema("Person")
참고 항목
참조
Microsoft.SqlServer.Management.Smo 네임스페이스