Comparing date to null in SQL server7

Results 1 to 3 of 3

Thread: Comparing date to null in SQL server7

  1. #1
    Join Date
    Dec 1969

    Default Comparing date to null in SQL server7

    Hi.<BR><BR>I&#039m having a bit of trouble finding out if a date exists in my DB. When I don&#039t fill in a date, my ASP passes a null value to the db. The field the contains &#039&#060;null&#062;&#039.<BR><BR>But when I try to see what dates are null, the comparison in the db tries to compare to a null-date, being the lowest date it knows. (around january 1980 or something like that).<BR><BR>The query thus returns no records.<BR><BR>Could anyone help, please ???<BR>Thanks.<BR>Bart.

  2. #2
    ??? Guest

    Default Show code, if you want help!

    Please let us see what you have tried. Then we may be able to guide you. But To tell us what is happening and to give us no clue as to why it is happening is just plain stupid!<BR><BR>The syntax for what you want is like this:<BR><BR>Select * from YourTable where DateField is null

  3. #3
    Join Date
    Dec 1969

    Default RE: Comparing date to null in SQL server7

    You need to check that there is a value in the form field and that it is a valid date<BR><BR>If Len(Request.form("DateField"))&#062; 0 And IsDate(Request.form("DateField")) Then<BR>Do something<BR>Else<BR>do nothing<BR>End If

Posting Permissions

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