DataType.UserDefinedType メソッド (String, String)

指定された型を表し指定されたスキーマを持つオブジェクトを返します。

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

構文

'宣言
Public Shared Function UserDefinedType ( _
    type As String, _
    schema As String _
) As DataType
'使用
Dim type As String 
Dim schema As String 
Dim returnValue As DataType 

returnValue = DataType.UserDefinedType(type, _
    schema)
public static DataType UserDefinedType(
    string type,
    string schema
)
public:
static DataType^ UserDefinedType(
    String^ type, 
    String^ schema
)
static member UserDefinedType : 
        type:string * 
        schema:string -> DataType
public static function UserDefinedType(
    type : String, 
    schema : String
) : DataType

パラメーター

戻り値

型: Microsoft.SqlServer.Management.Smo.DataType
DataType オブジェクトの値です。

使用例

次のコード例では、ユーザー定義型を作成する方法を示します。

C#

Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2012"];
Schema schema1 = new Schema(db, "ExampleSchema");
schema1.Create();
UserDefinedType udt = new UserDefinedTableType(db, "udt", "ExampleSchema");
udt.Create();
DataType userType = new DataType(SqlDataType.UserDefinedType, "udt", "ExampleSchema");

Powershell

$srv = new-object Microsoft.SqlServer.Management.Smo.Server("(local)")
$db = $srv.Databases.Item("AdventureWorks2012")
$schema1 = new-object Microsoft.SqlServer.Management.Smo.Schema($db, "ExampleSchema")
$schema1.Create()
$udt = new-object Microsoft.SqlServer.Management.Smo.UserDefinedType($db, "udt", "ExampleSchema")
$userTable = new-object Microsoft.SqlServer.Management.Smo.DataType([Microsoft.SqlServer.Management.Smo.SqlDataType]::UserDefinedType, "udt", "ExampleSchema")

関連項目

参照

DataType クラス

UserDefinedType オーバーロード

Microsoft.SqlServer.Management.Smo 名前空間

その他の技術情報

データ型の処理