Hi
How do i create a primary key index from two two or more columns in visual fox pro 9? The columns may be of different types
Hi
How do i create a primary key index from two two or more columns in visual fox pro 9? The columns may be of different types
Compound indexes should be strings, so use the appropriate function (STR(), DTOS(), etc.) to convert the field before concatenating it. See the MSDN documentation for more details.
Another word of caution is to make sure you never trim the character representation of any of the columns included in the keys.
Something else you should be aware of is that referential integrity code generated by VFP is sometimes not clean or designed to work well with concatenated keys. Code is a lot simpler for surrogate keys (single meaningless column, normally integer or GUID). It might be too late in the design for you to consider this, but I will put it out here just in case it is still in the design stage or still a practical change to make.
Rick Schummer VFP MVP