Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

SQL Server Create Index on Column in Table with Example

Jun 30, 2014
Introduction:

Here I will explain how to create index on column in
sql server 2008 or create index on multiple columns in sql server or create index on table in sql server 2008 with example.
Description:

To create index on column in sql server that syntax will be like as shown below

Syntax to Create Index


CREATE INDEX indexname ON Tablename(columnname)

Example:


CREATE INDEX IC_Userid ON UserDetails(UserId)

If you want to create nonclustered index on table we need to write the syntax like as shown below

Syntax to Create NonClustered Index on Column


CREATE NONCLUSTERED INDEX indexname ON Tablename(columnname)

Example:


CREATE NONCLUSTERED INDEX NC_Userid ON UserDetails(UserId)


If we want to create index on multiple columns at a time we need to write the query like as shown below

If we want to create index on multiple columns at a time we need to write the query like as shown below

Syntax to Create Index on Multiple Columns


CREATE INDEX IC_Userid ON UserDetails(Col1,Cpl2)

Example:


CREATE INDEX IC_Userid ON UserDetails(UserId,UserName)


If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

0 comments :

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.