Msg 542: An invalid datetime value was encountered. Value exceeds the year 9999

  • Guys:

    Some how an invalid or corrupt data ended up in the system. Presumably this happened when the database was upgraded from a legacy system. I know that in the old systems a bulk load process would allow bad dates to come in. It was a bug that was ignored by the dev team.

    I am trying to identify the rows in order to identify/correct the data but am having absolutely NO luck. I cant convert it nor does the isdate function work without error'ing out. Any suggestions? I am out of options.

    Thanks!

    Kindest Regards,
    David

    ** Obstacles are those frightening things that appear when we take our eyes off the goal. **

  • What is the datatype of the column containing the bad data?

    If it is not a DATE, DATETIME, DATETYPE2, or SMALLDATETIME datatype, what it the format of the data?

    If you really suspect database corruption, have you run DBCC CHECKDB against that database?

    DBCC CHECKDB ( MyDatabase )

    WITH NO_INFOMSGS, EXTENDED_LOGICAL_CHECKS, DATA_PURITY;

  • Run CheckDB with the Data_Purity option. For Resolving the error, see the section in this article on data purity errors and the kb article it links to.

    http://www.sqlservercentral.com/articles/65804/

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • I found the issue using the checkDB function with data purity which is what caused me to post. What I could not do was identify the rows themselves in the normal fashion that i do. Instead I jumped through hoops and did the RBAR thing trying to find the actual rows. I pretty much opened the table and looked at each row (70K rows) using the GUI rather than a simple query.

    There has to be an easier way! I am all ears and open to a better way!

    Kindest Regards,
    David

    ** Obstacles are those frightening things that appear when we take our eyes off the goal. **

  • David Paskiet (12/20/2012)


    There has to be an easier way! I am all ears and open to a better way!

    See the kb article referenced in the article I mentioned.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 5 posts - 1 through 4 (of 4 total)

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