Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


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


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

Author
Message
David Paskiet
David Paskiet
Old Hand
Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)

Group: General Forum Members
Points: 317 Visits: 202
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. **
Michael Valentine Jones
Michael Valentine Jones
Hall of Fame
Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)Hall of Fame (3.3K reputation)

Group: General Forum Members
Points: 3258 Visits: 11771
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;


GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47283 Visits: 44392
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


David Paskiet
David Paskiet
Old Hand
Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)Old Hand (317 reputation)

Group: General Forum Members
Points: 317 Visits: 202
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. **
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47283 Visits: 44392
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


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search