Skip to content

Latest commit

 

History

History
64 lines (44 loc) · 2.26 KB

File metadata and controls

64 lines (44 loc) · 2.26 KB
title Rename Statistics | Microsoft Docs
ms.custom
ms.date 03/14/2017
ms.prod sql
ms.reviewer
ms.technology performance
ms.topic conceptual
helpviewer_keywords
renaming statistics
statistics [SQL Server], renaming
ms.assetid a3bed7b7-3dc5-4b33-b1c6-67c27f573764
author julieMSFT
ms.author jrasnick
monikerRange =azuresqldb-current||>=sql-server-2016||=sqlallproducts-allversions||>=sql-server-linux-2017||=azuresqldb-mi-current

Rename Statistics

[!INCLUDEappliesto-ss-asdb-xxxx-xxx-md] You can rename a statistics object in [!INCLUDEssCurrent] by using [!INCLUDEtsql]

In This Topic

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

  1. In Object Explorer, connect to an instance of [!INCLUDEssDE].

  2. On the Standard bar, click New Query.

  3. Copy and paste the following example into the query window and click Execute.

    USE AdventureWorks2012;  
    GO  
    EXEC sp_rename N'AK_Employee_LoginID', N'AK_Emp_Login', N'STATISTICS';   
    GO  
    

For more information, see sp_rename (Transact-SQL).