Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CREATE CURSOR command
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01533423
Message ID:
01533432
Views:
43
>>>>>Hi everybody,
>>>>>
>>>>>Does CREATE CURSOR command allow to specify primary key? It is not listed in the syntax, but there is a mention of it in the text.
>>>>>
>>>>>I'm adding a field ID I AutoInc NextValue 2 and I want this field to be primary key in the table. What will be my syntax for this?
>>>>>
>>>>>I also checked CREATE TABLE command and it allows to specify field as Primary. So, is there a difference between CURSOR and TABLE and it's a limitation of the CURSOR?
>>>>>
>>>>>Thanks in advance.
>>>>
>>>>Nope,
>>>>PKs are allowed ONLY for DBC tables.
>>>>CURSORS are not DBC tables :-)
>>>>You must use candidate keys, instead of PKs
>>>
>>>So, I will be using UNIQUE clause, correct? The Help is a bit confusing.
>>
>>nope. candidate.
>
>I will be using UNIQUE clause in the CREATE CURSOR command. UNIQUE in there produces a candidate index.

No, UNIQUE is NOT like candidate. It just creates an index with UNIQUE values in it. It just didn't add duplicate values in the index, but doesn't prevent you to add duplicate values in the cursor/table.
CREATE CURSOR crsTest (Fld1 I PRIMARY KEY)
CREATE CURSOR test (Fld1 I)
INDEX on Fld1 TAG Test UNIQUE
INSERT INTO Test VALUES(1)
INSERT INTO Test VALUES(1)
INSERT INTO Test VALUES(1)
INSERT INTO Test VALUES(1)
INSERT INTO Test VALUES(1)
INSERT INTO Test VALUES(1)
BROWSE
SET ORDER TO
BROWSE
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform