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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

indexing descending 1

Status
Not open for further replies.

gentforreal

Programmer
Oct 19, 2002
62
US
INDEX ON STR(SKID)+STR(BAG)+STR(PKG) UNIQUE TO TANK descending

all three are numeric and 9 digit with no decimal.

what am I missing to make this work? I get an error each time.

 
Try:
INDEX ON STR(SKID,9)+STR(BAG,9)+STR(PKG,9) TO TANK UNIQUE descending

Note: "Unique" is an xBase backward compatibility syntax, and can cause "unexpected" results if you delete records that physically have the same key as another record without reindexing. In this context, it is not the same as Candidate.

Rick

 
I didnt know that. What would you suggest as a solution? There are no relations and no deletions in the dbase.
 
HI

UNIQUE in index will not allow duplicate index values to be present. Assuming you have a duplicate of the key combinations, the first occurance will participate and the subsequent records which has the same key value will not be present in the index.

However, if your intention is to enforce UNIQUEness, then make the INDEX as CANDIDATE or PRIMARY. One table can have only one PRIMARY key. Primary keys are unique and will not allow the user to allow another record with the same key. If an attempt is made, then an error will be thrown out.
The CANDIDATE keys can be many, they are idenical to PRIMARY and by their being a candidate for considering as PRIMARY key, they take the name CANDIDATE. The syntax for CANDIDATE key creation is identical. THE PRIMARY and UNIQUE keys are part of compound index .i.e. part of CDX files.

INDEX ON STR(SKID,9)+STR(BAG,9)+STR(PKG,9) ;
TO TANK CANDIDATE DESC

PRIMARY keys are created using CREATE TABLE or ALTER TABLE command and cannot be created using INDEX ON command.

The first CANDIDATE KEY, smallest in its length or the complexity of its build can be made as the PRIMARY KEY. However, there could be reasons for making another CANDIDATE key as the PRIMARY for any reson.

Hope this helps you :)

ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Yes, thats a huge help. I learned alot.
This is exactly the help I needed. Thanks so much.
 
oh.. I worked on it today.

Only structural tags can be defined as candidate.

Having each of the fields unique is what I want, no problem with how I defined what I want.

Any further suggestions as what I could look into to make this index descending? I am stumped now.
 
Maybe I am misunderstanding what you are asking, but if
after defining your indexes you to set it to descending, you can issue a
SET ORDER TO SomeTag DESCENDING

Or, in the database designer, you can click on the button under 'Index' and select either Ascending or Descending.
Dave S.
 
these are the lines in the program... its all I am trying to fix....

INDEX ON STR(SKID)+STR(BAG)+STR(PKG) UNIQUE TO TANK
REPLACE ALL PKGSORT WITH "*" && a blank 2 character field
CLOSE INDEX
GO BOTT
INDEX ON STR(SKID)+STR(BAG)UNIQUE TO TANK
REPLACE ALL BAGSORT WITH "**" && a blank 2 character field
CLOSE INDEX
 
When you say INDEX ON Whatever TO SomeIndex, you are actually creating a separate .IDX file name SomeIndex.IDX instead of the compact index method. Using this method, you cannot use the DESCENDING keyword, as well as other limitations like automatic index integrity. You either need to issue the command:

INDEX ON STR(SKID)+STR(BAG)+STR(PKG) TAG tank UNIQUE DESCENDING

- or add another command after creating your index:
INDEX ON STR(SKID)+STR(BAG)+STR(PKG) UNIQUE TO TANK
SET ORDER TO TANK DESCENDING
Dave S.
 
ahhh... that makes sense. Sometimes simple stuff gets by me.. LOL

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top