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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please Confirm SQL to Update Date Column Value to Null 1

Status
Not open for further replies.

Coder7

Programmer
Oct 29, 2002
224
0
0
US
Good morning everyone!

I haven't been able to find much info for this so I'd appreciate it if you sql gurus would confirm for me that the following is correct:

I have a value (i.e. 2003-12-31) in a nullable date field (i.e. end_date) in a db2 table (i.e. Table1) and I want to replace the date value (2003-12-31) with NULL. Will this do it:

Update Table1
Set end_date = Null
Where party_key = 1
and person_phone_seq_nbr = 2

Much thanks for any help and have a GREAT DAY!!
 
Yup, that should do the trick, provided your criteria is correct.
 
Thanks for your timely response....greatly appreciated :)
 
I've found that putting in NULL by itself doesn't work and you have to cast it to the correct data type:

Update Table1
Set end_date = cast (Null as date)
Where party_key = 1
and person_phone_seq_nbr = 2
 
Really? Set end_dt = NULL worked fine for me. What platform are you running on?
 
Dagon,

Just fyi, I ran the job yesterday to update the Production db2 data using = null without casting and it worked perfectly and the date value is now null so my experience is the same as PruSQLer's.

Have a great weekend all! :)


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top