Click here to Skip to main content
15,917,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


There is a table Consumer with fields
ImportDate DateTime
AccountNo Varchar(40)
AccountType Int
Name Varchar(40)
IDType Int
Country Int


There is no Primary Key in this table, and is it good for adding a NonClustered index on the ImportDate.
Posted
Updated 2-Jun-14 22:41pm
v4
Comments
Jörgen Andersson 3-Jun-14 10:02am    
Yes it's fine, but do add a primary key in any case.
Richard Deeming 3-Jun-14 11:54am    
NB: A primary key is not the same thing as a clustered index. It's quite possible to use a non-clustered index to support a primary key, and it's also possible to create a clustered index on a table without a primary key.

If what you've posted is the entire table definition, and records are always added with a newer ImportDate, I'd look at adding a clustered index to the ImportDate column, possibly adding secondary columns as required by your data. You'll still be able to have duplicate values in the fields; it just means the records will be physically stored in a logical order.

1 solution

hi clintoug,

Is not a question of yes/no, This is some thing you have to learn about these two type of indexes fist

so here is one good discussion over these indexes

http://stackoverflow.com/questions/4034076/reasons-not-to-have-a-clustered-index-in-sql-server-2005[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900