Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL - NULL for Date Field

Status
Not open for further replies.

cslawtom

MIS
Sep 3, 2001
161
HK
I would like to know that how could I insert a NULL into a date field. Many thanks.
 
first thing to do is to make sure the structure of the date field is set to allow nulls

then

replace mydat with null Attitude is Everything
 
As the two responses above point out, there IS a difference between a date field without a value ({ / / }) and one that is .Null. - don't confuse them, they react to comparisons and checks differently!

Rick
 
Sorry, I means statement for SQL Server.

Example:

Say record 'ABC' already contains a date "12/31/2002" and would like to replace with NULL. So how to define dddd?

x = "UPDATE Table SET DateFd = dddd WHERE KeyCd = 'ABC'"

= SQLEXEC(gnSQLConnection, x, "")

Thanks in advance.
 
to repeat:

the table first has to allow null values. the default is not to allow nulls.

x = "UPDATE Table SET DateFd = NULL WHERE KeyCd = 'ABC'"

this should work with SQL
Attitude is Everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top