Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2003
    Location
    Netherlands
    Posts
    98

    Unanswered: Need some help with check contraint in SQL2005

    Hi,

    I have this table which contains 2 datetime fields called Startdate & enddate

    Startdate cannot contain NULL
    Enddate can because it can be a single day event or a period.

    If enddate is not null it must be later than startdate
    i created this checkconstraint

    enddate > startdate

    But i also fires when enddate = NULL

    Someone knows howto do this?

    Cheers Wim

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Code:
    enddate > startdate
    OR
    enddate IS NULL
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Oct 2003
    Location
    Netherlands
    Posts
    98
    Thanx for your reply.

    But enddate could be NULL when NOTNULL it should be later then Startdate

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Your point being?
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Oct 2003
    Location
    Netherlands
    Posts
    98
    Sorry my bad, calendar control gives me 1-1-1980 instead of NUll

    Thanx for ur help!!
    CHeers Wim

Posting Permissions

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