Rick said:
If you are asking for a date, why do you want to prevent one from being
entered.
Commonsense business rules:
1) start_date must have a value, default to current date:
CREATE TABLE Test (
key_col INTEGER NOT NULL,
start_date DATETIME DEFAULT DATE() NOT NULL,
end_date DATETIME,
PRIMARY KEY (start_date, key_col)
);
2) end_date cannot being earlier than start_date:
ALTER TABLE Test ADD CONSTRAINT
non_sequential_dates CHECK (start_date <= end_date);
3) When INSERTed, start_date must always equal the current date on the
server:
ALTER TABLE Test ADD CONSTRAINT
start_date_not_current CHECK (start_date = DATE());
In order to stop a column from being UPDATEd, revoke all permissions
for the table and provide a PROCEDURE as the only means to INSERT a row
and a VIEW to be able to only read the table etc. For details, see the
security FAQ.
Jamie.
--