-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"Jim" <jim.ferris@.motorola.com> wrote in message
news:729757f9.0311282036.68e87388@.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|||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|||"Raghuraman" <raghuraman_ace@.rediffmail.com> wrote in message
news:66c7bef8.0311290600.46954ab5@.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
No comments:
Post a Comment