Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




Create or Drop index in a table through T-sql

Indexes are the part of a database. In Below query i am showing how to Create an Index in a Table.

Syntax: CREATE INDEX [IndexName] ON [dbOwner].[TabelName] ([ColumnName])
WITH ( ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY]



Example: CREATE INDEX [UQ_DateCreated] ON [dbo].[usertable] ([DateCreated])
WITH ( ALLOW_PAGE_LOCKS = OFF) ON [PRIMARY]

Usertable is table name where we are creating index. Select upper query and run to create index. In below query i am showing how to drop the index in a Table:

Syntax: DROP INDEX [IndexName] on dbOwner.TableName

Example: DROP INDEX [IX_Content] on dbo.Content

Share this article   |    Print    |    Article read by 1346 times
Author:
Rohit kakria
I am software developer, moderator of xpode.com
Related Articles:
Related Interview Questions: