后续版本的 Microsoft SQL Server 将删除该功能。请避免在新的开发工作中使用该功能,并着手修改当前还在使用该功能的应用程序。
The UserDefinedFunction object exposes the attributes of a single user-defined function.
.gif)
Properties
| 
 | 
Methods
备注
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
- Create a UserDefinedFunction object. 
- Set the Name property. 
- Set the Text property to contain the user-defined function. 
- Set optional property values. 
- 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.
| .gif) 注意: | 
|---|
| The UserDefinedFunction object is compatible only with SQL Server 2000 and later. |