Click to See Complete Forum and Search --> : Updating/Inserting Null date value


neelonweel
July 10th, 2001, 12:16 PM
Is it possible to insert or update a date field with a null value? I've tried NULL, "", and EMPTY but they all insert 1/1/1900. (the SQL db is set to accept Null values into the field).

neelonweel
July 10th, 2001, 02:56 PM
Stumbling around I found the solution here is the code in case someone else needs it:

datecompleted = Request.Form("datecompleted")
if datecompleted = "" then
SQL = "UPDATE task SET DateCompleted = NULL, "
SQL = SQL & "comments = '" & comments & "' "
SQL = SQL & "WHERE taskid = " & task("taskid")
dbconn1.execute(SQL)
else
SQL = "UPDATE task SET "
SQL = SQL & "datecompleted = '" & datecompleted & "', "
SQL = SQL & "comments = '" & comments & "' "
SQL = SQL & "WHERE taskid = " & task("taskid")
dbconn1.execute(SQL)
end if