.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

How to create index using SQL Server Management Studio

Posted By: Shweta     Posted Date: May 01, 2011    Points:5   Category :Sql Server
I know how to create index.But My doubt is should the index name be used in select statement?..If yes than how to write the sql query to create index statement for a select query?


Responses
Author: kamlesh             
Posted Date: May 02, 2011     Points: 20   

Please Check Below Link:

http://www.exforsys.com/tutorials/sql-server-2005/sql-server-defining-indexes.html
http://stackoverflow.com/questions/776527/sqlserver-2005-generate-all-index-as-create-statement
http://msdn.microsoft.com/en-us/library/ms188783.aspx

Thanks And Regards.
Kamlesh Nikam
Author: Pandian             
Posted Date: May 03, 2011     Points: 20   

Hi

I am not sure whether you asking about Forcing the Index.

Normally, Query Optimizer will automatically use the Indexes based on columns what we have used in WHERE clause and conditions.

In some situation, Indexes will not be used properly, In that case, We have to force the Index with the table hint.

Select * from TableName with (Index (IndexName))

Or, you can also use Index ID instaed of Index name.

Cheers

If not I then who, If not now then when
Author: Maverick             
Posted Date: May 04, 2011     Points: 20   

Hello,

Open the SQL management studio. Expand the tables trre node. Expand any table node. You will see index folder.

Right click on it to create new index.

Hope it helps.

Thanks,
Maverick
Author: Ani             
Posted Date: May 06, 2011     Points: 20   

Hi Shweta,

Suppose there is a table named TBL_CUSTOMER.It have the columns First_Name,Last_Name,City,Country

If we want to create an index on the column Last_Name, we would type in,

CREATE INDEX IDX_CUSTOMER_LAST_NAME
on TBL_CUSTOMER (Last_Name)


If we want to create an index on both City and Country, we would type in,

CREATE INDEX IDX_CUSTOMER_LOCATION
on TBL_CUSTOMER (City, Country)


Hope this helps..:)



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend