How to restrict a date from being entered

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How to restrict a date from being entered Example: start date/ end date
 
Huh?

If you are asking for a date, why do you want to prevent one from being
entered. Hav no idea what you are asking. Feel free to post full sentences
explaining what you are trying to do, including examples.

Rick B
 
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.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top