Creating a Table Where Date has to be Now OR Future
Results 1 to 2 of 2

Thread: Creating a Table Where Date has to be Now OR Future

  1. #1
    Join Date
    Mar 2011
    Posts
    0

    Creating a Table Where Date has to be Now OR Future

    How do i get a Table with the Collum Date That Looks if The Date that was put in is NOW or in the FUTURE
    This is What i got Right now.


    CREATE TABLE uitgifte
    (uitgiftenr SERIAL PRIMARY KEY,
    klantnr INT,
    datum DATE >= NOW,
    FOREIGN KEY (klantnr) REFERENCES klant (klantnr))

    The Date Idk how to Make it Check automatically for Dates Beyond.

  2. #2
    Join Date
    Jun 2012
    Posts
    1
    Quote Originally Posted by Shadowayara View Post
    ...
    CREATE TABLE uitgifte
    (uitgiftenr SERIAL PRIMARY KEY,
    klantnr INT,
    datum DATE,
    CONSTRAINT gt_now CHECK (datum >= now())
    FOREIGN KEY (klantnr) REFERENCES klant (klantnr))

    ...
    Try this. Note the separate table constraint.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •