{usekey}

When there are multiple choices for keys within a table, CONNX selects the optimal key choice.

There are two ways to manually override the selected key.

  • Place {usekey <key no.> } directly after the table name. CONNX will use the specified key, when possible.  However, the usage of the key is not guaranteed.

  • CONNX will accept a string that contains all of the key field names, separated by commas, instead of the key number. Place {Usekey '<keycolum#1>[,<keycolum#2>...]'} directly after the table name.

 

 

Example:

Key number

SELECT * FROM equipmnt_rms {usekey 2} where equipmnt_rms.location='MIS 
 DEPT.' and equipmnt_rms.description='TRAILBLAZER MODEM'
 
Key 
 field names
 
The 
 sample PRODUCT table that comes with CONNX has three keys on it:
 
Key 
 #0 = a composite key of orderid, customerid, and productid
Key 
 #1 = customerid
Key 
 #2 = productid
 
When 
 issuing the following SQL statement, CONNX will by default select key 
 #0 as the best key candidate.
SELECT * FROM RMS.dbo.orders_rms
where customerid = 'MERRG'
and productid = 40
and orderid = 1
 
 
 
The 
 following example uses tells CONNX to use the productid key.
 

 
The 
 following example uses tells CONNX to use the orderid, customerid, productid 
 composite key.