Forum Moderators: open

Message Too Old, No Replies

Updating NULL into date field

sql 2000, classic ASP

         

mattglet

12:07 pm on Oct 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



i have a sql statement that is giving me some trouble. i'm trying to update a "smalldate" field to NULL in SQL 2000. here's my statement:

SQL = "UPDATE [Order] SET bDone = " & bDone & ", comments = " & stringify(comments) & ", " & _
"datedone = " & null & ", cTotal = " & cTotal & " WHERE idOrder = " & idOrder
conn.execute(SQL)

here's the error:
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ','.

here's the statement being debugged:
UPDATE [Order] SET bDone = 0, comments = 'test', datedone = , cTotal = 225.00 WHERE idOrder = 10090

if i assign the datedone field = '' in the update, the statement works. it's only giving me trouble trying to insert the null value. the column is of type "smalldate", allowing nulls, with no default value.

any ideas?

-Matt

WebJoe

12:24 pm on Oct 2, 2003 (gmt 0)

10+ Year Member



If you want to insert a NULL-value do
SQL = "UPDATE [Order] SET bDone = " & bDone & ", comments = " & stringify(comments) & ", " & _ 
"datedone = NULL, cTotal = " & cTotal & " WHERE idOrder = " & idOrder
conn.execute(SQL)

note that I removed the

" &
,
& "
respectively around the
null

mattglet

12:33 pm on Oct 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



WebJoe-

that did it... it's too early to be working :)

i forgot i needed a SQL command, not an ASP command.

Thanks.

-Matt

WebJoe

5:21 am on Oct 3, 2003 (gmt 0)

10+ Year Member



np, glad I could help