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

Create Cursor with Index Question 1

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
Could someone help with the syntax for creating a cursor.
According to MSDN I need to add the word unique to the end but I have tried all sorts of things but with no success.

Code:
CREATE CURSOR SOLDIT (CODE C(10), QTY1 N(4), QTY2 N(4),SALE_NUM N(10), PRODUCT C(60), PRINCIPLE C(4)) 

* UNIQUE PRINCIPLE

Keith
 
Code:
CREATE CURSOR SOLDIT (CODE C(10), QTY1 N(4), QTY2 N(4),SALE_NUM N(10), PRODUCT C(60), PRINCIPLE C(4))
INDEX ON PRINCIPLE TAG SOLDIT UNIQUE

Borislav Borissov
 
The solution Borislav gave you does not set up a candidate key for your cursor. It creates the old-style unique index, which is a mostly useless thing.

To create a candidate key, put the UNIQUE keyword after the relevant field inside the parens:

Code:
CREATE CURSOR SOLDIT (CODE C(10), QTY1 N(4), QTY2 N(4),SALE_NUM N(10), PRODUCT C(60), PRINCIPLE C(4) UNIQUE)

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top