共用方式為


UserDefinedDatatypes Collection

未來的 Microsoft SQL Server 發行版本將不再提供此功能。請避免在新的開發工作中使用此功能,並計劃修改目前使用此功能的應用程式。

The UserDefinedDatatypes collection contains UserDefinedDatatype objects that reference a Microsoft SQL Server data integrity mechanism called a user-defined data type.

顯示目前物件的 SQL-DMO 物件模型

Properties

Count Property

Methods

Add Method

Refresh Method

Item Method

Remove Method (Collections)

ItemByID Method

 

備註

With the UserDefinedDatatypes collection, you can:

  • Create a new user-defined data type.
  • Remove a user-defined data type.

For more information about creating and removing user-defined data types by using the UserDefinedDatatype object and UserDefinedDatatypes collection, see UserDefinedDatatype Object.

When using the Item or Remove method, the UserDefinedDatatypes collection supports member identification using either name or ordinal reference syntax. For example:

Set oUDT = oDatabase.UserDefinedDatatypes("EmployeeID")

Or:

Set oUDT = oDatabase.UserDefinedDatatypes(2)

Additionally, when using name-based item selection, the Item method allows owner name qualification of the targeted SQL Server user-defined data type. For example:

Set oUDT = oDatabase.UserDefinedDatatypes("EmployeeID", "dbo")

When using the Remove method, the UserDefinedDatatypes collection does not support qualification of targeted object by owner name. It is suggested that you use the Item method to extract the target, and then use the Remove method of the UserDefinedDatatype object to drop a user-defined data type.

ms141185.note(zh-tw,SQL.90).gif附註:
Creating or removing SQL Server data integrity constraints implemented as user-defined data types by using the UserDefinedDatatypes collection requires appropriate privilege. The SQL Server login used for SQLServer object connection must be a member of the fixed role db_ddladmin or a role with greater privilege.