AA2e72E said:
CREATE TABLE MYTAB(MYCOL DECIMAL(10,2) DEFAULT 10)
How can I extend this statement to include a Validation Rule?
You can set the Validation Rule and its Validation Text (error message)
properties for a field or column by using the following clause on a
data-definition queries (ODBC SQL):
[CHECK Expression [ERROR MessageText]]
or
[SET CHECK Expression [ERROR MessageText]]
The first one applies to a CREATE TABLE query and the second one to one
using ALTER TABLE.
CHECK Expression: Specifies a validation rule for the field definition. It
must evaluate to a logical expression and can be a user-defined function or
a stored procedure on the target database. Whenever a blank record is
appended, the validation rule is checked. An error is generated if the
validation rule doesn't allow for a blank field value in an appended record.
ERROR MessageText: Specifies the error message displayed when the field
validation rule generates an error.
Look it up on the help (or online), try it, and let us know.
-Randy