Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programmatically create PRIMARY key with FOR clause
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00323092
Message ID:
00323567
Views:
28
Bob & Randy,
Here's a sample code (not the actual one I'm using, but much more readable):
CREATE DATA datTest
CREATE TABLE tblTest (cKey C(1))
ALTER TABLE tblTest ADD PRIMARY KEY cKey TAG cKey FOR .NOT.EMPT(cKey)
Switching the order of the TAG/FOR clauses makes no difference.

>>Thanks, Bob...
>>Well, I've tried it both ways, and get a Syntax Error.
>>
>>>Change the sequence of your FOR and your TAG command. I think it works one way but not the other... but, I can't remember which you had to put first.
>
>Hmm... this is from the other forum I got this info from...
>
>***********
>This seems to indicate that you can programatically create a primary key with a filter...
>
> Yes, it does, doesn't it?
>
> I found out the problem. Both Anders Altberg and Doug Hennig clued me in to the fact that the docs are wrong: the FOR clause must appear before the TAG clause. It was wrong in both the VFP docs (no surprise) and the Hacker's Guide (a first!).
>**********
>
>Why don't you post your code here?
>
>BOb
"It hit an iceberg and it sank. Get over it."
Robert Ballard, dicoverer of the Titanic wreckage.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform