UserDefinedType 方法 (String, String)
Returns an object that represents the specified type with the specified schema.
命名空间: 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
参数
- type
类型:System. . :: . .String
A String value that specifies the type.
- schema
类型:System. . :: . .String
A String value that specifies the schema.
返回值
类型:Microsoft.SqlServer.Management.Smo. . :: . .DataType
A DataType object value.
示例
The following code example shows how to create a user-defined type.
C#
Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2008R2"];
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("AdventureWorks2008R2")
$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")