Introduction:
When
create table and set Primary key, an index will be created automatically. But
we can also set index manually.
I this article I will explain how to create index on column in or create index on multiple columns in sql server or create index on table in sql server 2008 with example.
I this article I will explain how to create index on column in or create index on multiple columns in sql server or create index on table in sql server 2008 with example.
Create Index
on Single Column:
Syntax to Create Index
CREATE INDEX indexname ON Tablename(columnname)
Example:
CREATE INDEX IC_Empid ON EmpDetails(EmpId)
Create nonclustered index on table
Syntax to Cre ate
NonClustered Index on Column
CREATE NONCLUSTERED INDEX indexname ON Tablename(columnname)
Example:
CREATE NONCLUSTERED INDEX NC_Empid ON EmpDetails(EmpId)
create index on multiple columns at a time
Syntax to Create Index on Multiple Columns
Syntax to Create Index on Multiple Columns
CREATE INDEX IC_Empid ON Table_Name(Col1,Cpl2)
Example:
CREATE INDEX IC_Empid ON EmpDetails(EmpId,EmpName)
0 comments:
Post a Comment