Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 295 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SQL Server Index Naming Conventions

#1
Is there some standard way to name indexes for SQL Server? It seems that the primary key index is named PK_<tablename> and non-clustered indexes typically start with IX_<tablename>. Are there any naming conventions beyond that for unique indexes?
Reply

#2
I usually name indexes by the name of the table and the columns they contain:

ix_tablename_col1_col2
Reply

#3
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>`
Reply

#4
I know a old topic but thought I'd throw in my 2cents worth

- PKC_ Primary Key, Clustered
- PKNC_ Primary Key, Non Clusterd
- NCAK_ Non Clustered, Unique
- CAK_ Clustered, Unique
- NC_ Non Clustered


Example;

NCAK_AccountHeader_OrganisationID_NextDate

Where NCAK : Non Clustered, Unique, AccountHeader : Table and OrganisationID_NextDate : Columns.
Reply

#5
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]
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through