UPDATE null/empty into date
I have a date field that I INSERT a date. During edit/UPDATE, I want it returned to null or empty.
I've seen several option by googling, but none have worked.
Is this possible?
do you mean ... update table set date_column = null where whatever?
How is your date column defined?
What are you exactly doing?
What's the error message you are getting?
Pablo (Paul) Berzukov
Author of Understanding Database Administration
available at amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
yes, I do mean "update table set date_column = null where whatever".
1 - My column is specified "date_expired DATE". I'm using it for a date for an item to be expired, but sometimes after it's set, it's decided that the date for it to be expired should not be set, so I need to clear it.
2 - I'm not getting an error message in that I don't know what to put into it to clear it. I tried SqlDateTime.Null and DBNull.Value among others. For those it's a similar message of "Element VALUE is undefined in DBNUL". That's not useful.
Sorry to bother, but any help on this? I'm really at a standstill.
I sorta vaguely remember that I can set up a field on initialization to accept null instead of expected content. But I've not found anything on that.
"I tried SqlDateTime.Null and DBNull.Value among others."
Well, if you use Oracle supported SQL syntax and datatypes, what you were shown before will work. SqlDateTime.Null and DBNull.Value is not Oracle syntax.
Update the table/records where the date needs to be null. Simple. No brainer.
Alright, well a simple NULL worked (date_expired = NULL)
The error and problem was because in using Cold Fusion, I was using a tag:
and in that case, it was producing an error because it was expecting a date type I assume. I just removed the tag and it worked.
Thanks for your comments.
Click Here to Expand Forum to Full Width