Question

I need to check and see if a validation rule exists on a table and/or field in FoxPro (to determine programmatically if it should be replaced/added/removed). DISPLAY STRUCTURE doesn't include any validation rules.

Is there a VFP command to list out validation rules on a table (to an array, file, cursor, anything)?

Was it helpful?

Solution 2

You can use DBGETPROP to get information for a single DB-object/field:

? DBGETPROP("mytable.myfield","Field","RuleExpression")

or for a table:

? DBGETPROP("mytable", "Table", "RuleExpression")

OTHER TIPS

I found that AFIELDS() and COPY STRUCTURE EXTENDED both include field and table validation rules.

For AFIELDS() the table expression is stored on the first row of the array in column 10, and the field validation expression is stored with each row in column 7.

For COPY STRUCTURE EXTENDED the table expression is in the first row in a memo column called table_rule and the field expression is stored with each rule in a memo column called field_rule.

Another option is to use the GenDBC utility that comes with VFP. It generates a program that recreates the database.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top