UPDATE null/empty into date
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: UPDATE null/empty into date

  1. #1
    Join Date
    Sep 2004
    Posts
    51

    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?


    thanks.

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,554
    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.

  3. #3
    Join Date
    Sep 2004
    Posts
    51
    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.

  4. #4
    Join Date
    Sep 2004
    Posts
    51
    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.

  5. #5
    Join Date
    May 2002
    Posts
    2,645
    "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.

  6. #6
    Join Date
    Sep 2004
    Posts
    51
    Alright, well a simple NULL worked (date_expired = NULL)
    The error and problem was because in using Cold Fusion, I was using a tag:
    date_expired =

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width