Warning settting a datetime to NULL

  • I have a strange issue that I was hoping someone could shed some light on the subject.

    One of our developers is dummying up some data in a test database for testing.  She is part of the db_owners group in this database.  The data she is trying to dummy up is setting a datetime field to NULL.  This is the query she uses:

    UPDATE MyTable

    SET MyDateTimeField = NULL

    WHERE MyDateTimeField = '1/21/2005'

    The MyDateTimeField has a value of '2005-1-21 00:00:00.000'.

    When she runs this, she keeps getting a message that running this query would truncate data and the query won't run.

    I ran the same query and it worked fine for me.  I am the system admin but because she is part of the db_owners role I just don't see it being a permissions problem.

    Any insight?

    Thank you.

    hawg

    ----------------------------------------------------------01010011010100010100110000100000010100110110010101110010011101100110010101110010001000000101001001101111011000110110101101110011

  • I think the reason could be somewhere in the settings (your PC could have other settings than her PC)... did you try to ask her to run the same query with date in "proper" order?

    UPDATE MyTable

    SET MyDateTimeField = NULL

    WHERE MyDateTimeField = '2005.21.01'

    There is a chance that SQL server has some problems converting her form of date from varchar to datetime, or treats the updated field as varchar or something like that... and sends back this error which is a bit misleading. Not sure whether this helps, but I have no other ideas

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply