Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Index not sorting properly

Status
Not open for further replies.

MeonR

Programmer
Aug 16, 2002
97
US
Hi,

I have a routine in vb6 that inserts a series of records
these records need to be in month order i.e. Jan.Feb.Mar..
etc. Since pervasive does'nt seem to have anyting like an Auto-Increment; I created a Segemented Index Which uses the
Month Column and a Integer Column and set them both to Asc
everything works fine except the values are going in backwards, ie Dec,Nov,Oct... Any Ideas?

Thanks MeonR

 
Which is the first part of your index the month or the additional integer?

Are the month values held in the database as numbers, e.g. 12 = Dec, 11 = Nov, 10 = Oct - have you tried doing an Order By in your SQL statement?
 
Actually, Pervasive does have an Auto-Increment. With Pervasive.SQL 2000 and later, it's called identity. With previous versions it was called AutoIncrement.

Are you using SQL to read the tables? If so, like TomKane asked, do you have an Order By? If not, then there is no guarantee of order.

info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician
 
Thanks again!!!

Yes we use ORDER BY, This works well, I was attempting to get them to insert in correct date order. guess it does'nt matter as long as the user gets it back in correct order.

Again thanks

MeonR
 
In order to guarantee any order on return, you're going to need to use the ORDER BY. Otherwise, Pervasive just uses "STEP" operations to read the table in physical order rather than logical order.

info@mirtheil.com
Custom VB and Btrieve development.
Certified Pervasive Developer
Certified Pervasive Technician
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top