Xpode.com        Click here to Print this article.

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



http://
http://

Contributed by:
Rohit kakria
I am software developer, moderator of xpode.com

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=11

Click here to go on website