Rename user-defined functions
Applies to: SQL Server (all supported versions) Azure SQL Database
You can only rename user-defined functions in SQL Server by using SQL Server Management Studio.
Limitations and restrictions
Function names must comply with the rules for identifiers.
Renaming a user-defined function won't change the name of the corresponding object name in the definition column of the sys.sql_modules catalog view. Therefore, we recommend that you don't rename this object type. Instead, drop and re-create the stored procedure with its new name.
Changing the name or definition of a user-defined function can cause dependent objects to fail when the objects aren't updated to reflect the changes that have been made to the function.
Dropping the function requires either ALTER permission on the schema to which the function belongs, or CONTROL permission on the function. To re-create the function, requires CREATE FUNCTION permission in the database and ALTER permission on the schema in which the function is being created.
Use SQL Server Management Studio
In Object Explorer, select the plus sign next to the database that contains the function you wish to rename and then
Select the plus sign next to the Programmability folder.
Select the plus sign next to the folder that contains the function you wish to rename:
- Table-valued Function
- Scalar-valued Function
- Aggregate Function
Right-click the function you wish to rename and select Rename.
Enter the function's new name.
This task can't be performed using Transact-SQL statements. To rename a user-defined function using Transact-SQL, you must first delete the existing function, and then re-create it with the new name. Ensure that all code and applications that used the function's old name now use the new name.
Submit and view feedback for