Posts

Showing posts from October, 2012

Create a Table Index in Sql Server

CREATE [UNIQUE | DISTINCT] [ CLUSTERED | NONCLUSTERED ] INDEX index_name ON table_name (column_name [ASC | DESC], column_name [ASC | DESC]...) here UNIQUE means You can only have one primary key on each table. However, if you wish to enforce uniqueness in other non-key columns, you can designate that the index be created with the UNIQUE constraint. You can create multiple UNIQUE indexes for a single table and can include columns that contain NULL values (although only one NULL value is allowed per column combo). [ CLUSTERED | NONCLUSTERED ] Specifies the index type, either CLUSTERED or NONCLUSTERED. You can only have one CLUSTERED index, but up to 249 NONCLUSTERED indexes. And index_name The table or view to be indexed. The column or columns to be used as part of the index key. [ ASC | DESC ] is The specific column order of indexing, either ASC for ascending order or DESC for descending order. ClusterIndex :- CREATE TABLE HumanResources.TerminationReason(