Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with primary key
Message
From
23/07/2005 23:23:58
 
 
To
23/07/2005 23:06:34
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01035448
Message ID:
01035453
Views:
10
Jimmy,

>I am trying to set a primary key for a character field and a date field through an expression. I have thhe following:
>
>ssnumber+orderdate
>
>ssnumber is a character field and the orderdate is a date field. When I try and save it I get the following:
>
>Operator/operand type mismatch
>
>Newbie and need help.

There are several ways to convert a date to a character representation of the date. In this case, I would use the expression ssnumber + DTOS(orderdate). Given an ssNumber '999999999' and today's date the expression would generate the string '99999999920050723'.

That said, using the ss number + the order date as a primary key will limit the orders to one order per person per day. If the limitation enforces a business rule, that's fine. If, however, there is no business rule that states the a person is limited to one order per day, then you have a design issue that may come back to bite you. In that case you might want to consider a surrogate primary key such as an autogenerated integer key.

Hope this helps.

Jim Fisher
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform