By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,017 Members | 979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,017 IT Pros & Developers. It's quick & easy.

Current date in Table Constraints

P: 1
Hi, I am new to DB2 (and SQL) and I am having some problems with the current date. I am trying to make sure the date in the table review is not past the current day using a constriant. I have tried creating the table this way.

CREATE TABLE Reviews(
isbn ISBN NOT NULL,
reviewer CHAR30,
rating INT,
date DATE,
comment VARCHAR(500),
FORIEGN KEY(isbn) references Books(isbn),
CHECK( 0 < rating >= 5),
CHECK(date <= current date)
)

When I try to execute this, I get an error saying:
"SQL0548N A check constraint or generated column that is defined with
"current" is invalid. SQLSTATE=42621"
I have also tried "VALUES current date" instead for current date. Can somebody tell me how to fix this, or if I am going about this all wrong.
Thank You.
Feb 8 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.