?
Solved

Add index to table

Posted on 2011-04-22
8
Medium Priority
?
283 Views
Last Modified: 2012-05-11
I have a table with a primary key.
How would I add an index to an additional column?
0
Comment
Question by:lrbrister
8 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35447000
you create another index, normally on just that column.

what is the exact issue you have?
0
 
LVL 4

Expert Comment

by:malikirfan28
ID: 35447023
There are normally two types of indexes - Clustered and non-Clustered. Primary keys normally create clustered index. So which type of index do you want to create on another column?

If you want to create nonclustered index then you can simply use

CREATE INDEX INDEX_NAME
on TABLENAME (COLUMN NAME)
0
 

Author Comment

by:lrbrister
ID: 35447039
angelIII:

I have a table that stores our media "mail history" ...actual addresses for bulk mail

the mailID is the primary key

Ive been asked to add an index on AddrID column
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 37

Expert Comment

by:Neil Russell
ID: 35447047
So if your table is called MailHistory you would use

CREATE INDEX idxAddrID
on MailHistory (AddrID)
0
 

Author Comment

by:lrbrister
ID: 35447058
malikirfan28: was first and Neilsr: was precise

Any problems with a 350/150 split?
0
 
LVL 4

Accepted Solution

by:
malikirfan28 earned 2000 total points
ID: 35447065
You didn't mention the table name/column name so I could not give precise example :(
But I gave you the syntax.
0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 35447092
Hey you can create a non cluster index on other than primary key. Same as cluster index

Create index Indexname on Table (Columnname)
0
 

Author Closing Comment

by:lrbrister
ID: 35459265
malikirfan28
You have a  valid point
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question