|
 |
asptoday_discuss thread: ASP, SQL Server and NULL date fields
Message #1 by "Anthony Wilko" <tony@i...> on Thu, 25 Jul 2002 20:06:25
|
|
Maybe it's just me, but I'm having a REAL hard time with this one. I'm
trying to insert a NULL value into a datetime field in SQL Server via an
Insert Query on an ASP page. SQL Server keeps defaulting the field to
1/1/1900 even though I put in a NULL.
However, I can run an UPDATE query and set the datetime field = NULL and
it works just fine.
Anyone have any thoughts or ideas??
Regards,
Tony
Message #2 by "Mark Phillips" <webmaster@d...> on Thu, 25 Jul 2002 20:22:01 +0100
|
|
If you're using a stored proc to insert the row, you should be able to
explicitly set the value to NULL inside VB code - just set the value of the
parameter to Null (the VB keyword) - don't put it inside quotes.
Alternatively if you're using a stored proc and the field is always going to
get NULL when a row is inserted (e.g. date time last updated) then either
set the value to NULL (hard-code) inside the stored proc, or - easiest of
all, whether using a stored proc or not - just don't set anything for the
value. Don't include it in the column list at all. Then it will be NULL by
default.
Mark
-----Original Message-----
From: Anthony Wilko [mailto:tony@i...]
Sent: 25 July 2002 20:06
To: ASPToday Discuss
Subject: [asptoday_discuss] ASP, SQL Server and NULL date fields
Maybe it's just me, but I'm having a REAL hard time with this one. I'm
trying to insert a NULL value into a datetime field in SQL Server via an
Insert Query on an ASP page. SQL Server keeps defaulting the field to
1/1/1900 even though I put in a NULL.
However, I can run an UPDATE query and set the datetime field = NULL and
it works just fine.
Anyone have any thoughts or ideas??
Regards,
Tony
|
|
 |