473,385 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Clustered index not working

Jim
I put a clustered index on a table with 2 columns

-nationalityid int autoincrement PK

-nationality varchar(50)
the clustered index is on nationality

however; when i do a select i still get a record set back ordered by
the nationality id...what am I doing wrong?

-Jim
Jul 20 '05 #1
3 2105

"Jim" <ji********@motorola.com> wrote in message
news:72**************************@posting.google.c om...
I put a clustered index on a table with 2 columns

-nationalityid int autoincrement PK

-nationality varchar(50)
the clustered index is on nationality

however; when i do a select i still get a record set back ordered by
the nationality id...what am I doing wrong?

-Jim


When you do a SELECT, you must specify ORDER BY if you want the result set
to be in a certain order. Even with a clustered index on a table, there is
no guarantee that you will get your results in any specific order.

Simon
Jul 20 '05 #2
Hi ,
The clustered index is usually set on in the primary key field.The
query optimiser selects the records and displays as per the P.K Field
by default ascending.

Since u have CLUSTERED INDEX which is a non P.K field , U hadthe
problem.
Generally , Clstered index is only used for the sake of speed fetching
..
I thing my words clear.
Raghu
India
Jul 20 '05 #3

"Raghuraman" <ra************@rediffmail.com> wrote in message
news:66**************************@posting.google.c om...
Hi ,
The clustered index is usually set on in the primary key field.The
query optimiser selects the records and displays as per the P.K Field
by default ascending.

"Maybe".

Without and ORDER BY there is no guarantee what order you will get stuff
back in.

Now, in most cases you may see the behaviour you describe, but I would not
count on it.
Since u have CLUSTERED INDEX which is a non P.K field , U hadthe
problem.
Generally , Clstered index is only used for the sake of speed fetching
.
I thing my words clear.
Raghu
India

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Steve_CA | last post by:
Hi, The more I read, the more confused I'm getting ! (no wonder they say ignorance is bliss) I just got back from the bookstore and was flipping through some SQL Server Administration...
5
by: jim_geissman | last post by:
One table I manage has a clustered index, and it includes some varchar columns. When it is initially created, all the columns in the clustered index are populated, and then some of the longer...
2
by: Fred | last post by:
Let's say I suddenly discover that an unclustered table would benefit if it was clustered on column(s) already indexed. Currently, I'd need to drop that perfectly good index just to re-create it as...
1
by: anonieko | last post by:
A lot of detailed discussion explains the difference between clustered and non-clustered indexes. But very few 'clarifies' why the term used is 'clustered'. Well, once and for all, this is my...
2
by: Lyle Fairfield | last post by:
'Property Clustered As Boolean 'Member of DAO.Index Private Sub IsThereaClusteredIndex() Dim tdf As DAO.TableDef Dim idx As DAO.Index For Each tdf In DBEngine(0)(0).TableDefs For Each idx In...
5
by: pb648174 | last post by:
I've been doing a bit of reading and have read in quite a few places that an identity column is a good clustered index and that all or at least most tables should have a clustered index. The tool I...
1
by: Curt | last post by:
What is the difference please?
4
by: codefragment | last post by:
Hi I thought that given a table with an index, primary key and clustered index any non clustered index look ups would go via the clustered index and the primary key is irrelevant? (sql server...
1
by: David Portas | last post by:
"Erland Sommarskog" <esquel@sommarskog.sewrote in message news:Xns9B5AD2ADD1265Yazorman@127.0.0.1... Erland, I'm sure you mean that to be with love and care, rather than just "slap on" any...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.