Nuta
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować się zalogować lub zmienić katalog.
Dostęp do tej strony wymaga autoryzacji. Możesz spróbować zmienić katalogi.
Returns an object that represents the specified type.
Namespace: Microsoft.SqlServer.Management.Smo
Assembly: Microsoft.SqlServer.Smo (in Microsoft.SqlServer.Smo.dll)
Syntax
'Declaration
Public Shared Function UserDefinedType ( _
type As String _
) As DataType
'Usage
Dim type As String
Dim returnValue As DataType
returnValue = DataType.UserDefinedType(type)
public static DataType UserDefinedType(
string type
)
public:
static DataType^ UserDefinedType(
String^ type
)
static member UserDefinedType :
type:string -> DataType
public static function UserDefinedType(
type : String
) : DataType
Parameters
- type
Type: System.String
A String value that specifies the type.
Return Value
Type: Microsoft.SqlServer.Management.Smo.DataType
A DataType object value.
Examples
The following code example shows how to create a user-defined type.
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");
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")
See Also
Reference
Microsoft.SqlServer.Management.Smo Namespace