Rename Statistics
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance
You can rename a statistics object in SQL Server by using Transact-SQL
In This Topic
Before you begin:
To rename a statistics object, using:
Before You Begin
Limitations and Restrictions
By default, creating an index creates a statistic on the key columns of that index. Therefore, renaming the index automatically renames the statistics object, and vice versa.
Changing any part of an object name can break scripts and stored procedures. Instead of renaming, we recommend that you drop the statistics object and re-create it with the new name.
Security
Permissions
Requires ALTER permission on the table or view.
Using Transact-SQL
To rename a statistics object
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute.
USE AdventureWorks2022; GO EXEC sp_rename N'AK_Employee_LoginID', N'AK_Emp_Login', N'STATISTICS'; GO
For more information, see sp_rename (Transact-SQL).
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for