How to use index in sql server

Posted by Gopal_nivas under Sql Server on 7/11/2011 | Points: 10 | Views : 6227 | Status : [Member] | Replies : 6
hi..

how to use index in sql server.
and also i want to know why to use index.


need ur suggestions with examples
regards
gopal.s




Responses

Posted by: Vilasgite080 on: 7/11/2011 [Member] Starter | Points: 25

Up
0
Down
hi Gopal
please read this article, nice one..
http://www.dotnetfunda.com/articles/article177.aspx
thanks...
-----------------
If this reply hepls your post.then "MARK AS ANSWER"!

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A4u_6178 on: 7/11/2011 [Member] Starter | Points: 25

Up
0
Down
Hi gopal,
The following is syntax for how an index is used in sql server..
CREATE INDEX index_name

ON table_name (column_name)

Why to use Index in sql server..
*Indexes allow the database application to find data fast; without reading the whole table.
and one thing to note is that index should not be used on columns (or tables) against which ur performing search, becoz the index should also be updated and hence consumes time.

Thanks & Regards,

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RaviRanjanKr on: 7/11/2011 [Member] Starter | Points: 25

Up
0
Down
In addition to above answer you can also navigate given links
http://www.codeproject.com/KB/database/Define_Index_in_SQLServer.aspx
http://www.wwwcoder.com/main/parentid/191/site/4218/68/default.aspx

about your second question..

when a user queries data from a table based on conditions, the server scans all the data stored in the database table. with an increasing of data. the execution time for queries also increase. as a database developers, we need to ensure that the users are able to access data in the least possible time. to accomplish this task SQL server provides functionality to create Index for storing data in Index format.
There are basically two type of Index Clustered Index and NonClustered Index
To know about clustered Index.. Try
http://msdn.microsoft.com/en-us/library/aa933131(v=sql.80).aspx
and to know about Non clustered Index.. Try
http://msdn.microsoft.com/en-us/library/ms177484.aspx

Thanks
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 5/20/2012 [Member] Starter | Points: 25

Up
0
Down
HI,

USE INDEX TO FETCH RECORD FASTLY.BOOK IS AN INDEX TO SEARCHING A BOOK USING INDEX TO FETCH RECORD EXACTLY .IT WONT SEARCH SEQUENTIAL ORDER.

CREATE INDEX index_name

ON table_name (column_name)
WE HAVE TWO TYPE OF INDEX AVAILABLE

1) CLUSTERED INDEX
2) NON CLUSTERED INDEX


REGARDS


sriram

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response