Using SQL Server Management StudioRight-click the table on which you want to rename an index and select Design. On the Table Designer menu, click Indexes/Keys. Select the index you want to rename in the Selected Primary/Unique Key or Index text box. In the grid, click Name and type a new name into the text box.
A nonclustered index is an index structure separate from the data stored in a table that reorders one or more selected columns.
No, rename of the table does not cause indexes to rebuild.
I use
PK_ for primary keys
UK_ for unique keys
IX_ for non clustered non unique indexes
UX_ for unique indexes
All of my index name take the form of<index or key type>_<table name>_<column 1>_<column 2>_<column n>
I usually name indexes by the name of the table and the columns they contain:
ix_tablename_col1_col2
Is it worth a special prefix for indices associated with foreign keys? I think so, since it reminds me that indices on foreign keys are not created by default, and so it is easier to see if they are missing.
For this, I am using names that match the name of the foreign key:
FK_[table]_[foreign_key_table]
or, where multiple foreign keys exist on the same table
FK_[table]_[foreign_key_table]_[foreign_key_field]
I know a old topic but thought I'd throw in my 2cents worth
Example;
NCAK_AccountHeader_OrganisationID_NextDate
Where NCAK : Non Clustered, Unique, AccountHeader : Table and OrganisationID_NextDate : Columns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With