Online Documentation for SQL Manager for SQL server

Creating/editing UDT


Use the Type tab of UDT Editor to create/edit a user-defined data type and specify its properties.

 

If you create a new user-defined type, you should first specify its implementation kind.

 

UDT Editor - New UDT

 

 

RadioButton Alias data type

This selection specifies that an alias data type will be created on the basis of an existing SQL Server data type.

 

RadioButton CLR data type

This selection specifies that the user-defined will be taken from an assembly.

 

RadioButton Table data type

This selection specifies that a new user-defined table type will be created.

 

 

Name

Enter a name for the new user-defined type, or modify the name of the user-defined type being edited.

 

Schema

Use the drop-down list to select the schema to which the user-defined type belongs. The default selection is the default schema for the current user. For Microsoft® SQL Server 2000 or SQL Server 7.0, specify the owner of the UDT (the default value is the current user).

 

 

Alias Data Type Properties

 

UDT Editor - Editing UDT definition - Alias Data Type

 

 

Type

Use the drop-down list to select SQL Server supplied data type on which the alias data type is based (base_type). The base type of an existing UDT is not editable.

 

CheckBox Not Null

Specify whether the UDT can accept NULL values. The nullability of an existing UDT is not editable.

 

Size

Specify the size value (for certain types). Check CheckBox Maximum size to use the maximum values set by SQL Server.

 

Scale

Defines the maximum number of decimal digits that can be stored to the right of the decimal point of the value (for numeric and decimal data types).

 

Rule

Use the drop-down list to select a rule to bind to the user-defined data type (optional). Check CheckBox For new columns only to apply the selected rule only to newly added columns.

 

Default

Use the drop-down list to select a default to bind to the user-defined data type (optional). Check CheckBox For new columns only to apply the selected default only to newly added columns.

 

Note: Some properties cannot be modified because of dependent objects. Open the Dependencies tab to browse the list of dependent objects, or view the dependency tree for the user-defined type.

 

 

CLR Data Type Properties

 

UDT Editor - Editing UDT definition - CLR Data Type

 

 

Assembly

Use the drop-down list to select the SQL Server assembly that references the implementation of the user-defined type in the common language runtime (CLR). The assembly must have been already created in the database.

 

Class name

Specifies the class within the assembly that implements the user-defined type. The class name can be a namespace-qualified name (if the programming language that is used to write the class uses the concept of namespaces, such as C#).

 

 

Table Data Type Properties

 

UDT Editor - Editing UDT definition - Table Data Type

 

 

Columns

This area lists the columns of the user-defined type as a grid.

Double-click a field to open Field Editor for editing the field.

Right-click within the Columns area to display the context menu allowing you to add new, insert, edit using Field Editor, delete the selected field, or move it up/down within the list.

 

The Columns list provides the following attributes of each field of the UDT:

Primary Key

Column Name

Data Type

Size/Precision

Max Size

Scale

Not Null

Unique

Identity

Sparse

Filestream

Default Value

Comment

 

For details see Fields.