共用方式為


UserDefinedFunction Object

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

The UserDefinedFunction object exposes the attributes of a single user-defined function.

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

Properties

AnsiNullsStatus Property

Name Property

CreateDate Property

Owner Property (Database, UserDefinedFunction)

Encrypted Property

QuotedIdentifierStatus Property

ID Property

SystemObject Property

IsDeleted Property

Text Property

IsDeterministic Property

Type Property (UserDefinedFunction)

IsSchemaBound Property

 

Methods

Alter Method

Grant Method (StoredProcedure, UserDefinedFunction)

Deny Method (UserDefinedFunction)

ListPermissions Method

EnumDependencies Method

ListUserPermissions Method

EnumOutputs Method

Remove Method (Objects)

EnumParameters Method

Revoke Method (UserDefinedFunction)

備註

With the UserDefinedFunction object, you can:

  • Create a Microsoft SQL Server user-defined function.
  • Change the definition of an existing SQL Server user-defined function.
  • Control access rights to an existing SQL Server user-defined function.
  • Delete an existing SQL Server user-defined function.
  • Generate a Transact-SQL script to re-create a SQL Server user-defined function.

The Name property of a UserDefinedFunction object uses the SQL Server sysname data type. The value of the Name property must be unique (named by owner) within a SQL Server database.

To create a SQL Server user-defined function

  1. Create a UserDefinedFunction object.

  2. Set the Name property.

  3. Set the Text property to contain the user-defined function.

  4. Set optional property values.

  5. Add the UserDefinedFunction object to the UserDefinedFunctions collection of a connected Database object.

After a user-defined function is created, you cannot reset the Name property. To change the name of a user-defined function, you must call the Remove method to drop and then re-create the object.

ms132943.note(zh-tw,SQL.90).gif附註:
The UserDefinedFunction object is compatible only with SQL Server 2000 and later.