I have a problem: on a simple select like SELECT * FROM table
SqlDateTime overflow error is randomly returned (few times it works OK after that error is returned; after that it again works few times and after that error is returned again) - error occurs on the same row (while using the same connection) - if I open and close MGMT Studio, error occurs on different row.
Exact error message is:
An error occured while executing batch. Error message is: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
Table has 3 DateTime columns:
- DTcolumn1 - can be null, without default value
- DTcolumn2 - must not be null, default value ('1800-01-01')
- DTcolumn3 - can be null, without default value
Values in all 3 DateTime columns look fine (null or inside of the allowed interval).
Table also has some other columns of varchar and other types. It is more likely that select query will fail more often if I add order by one of those 3 DateTime columns (empiricaly tested).
Collation of the database is Slovenian_CI_AI
.
What is causing this error (as I said - DateTime values seem to be OK)?
Thank you in advance!
EDIT 1 (2016-05-09): I forgot to mention it previously: error happens in SQL MGMT Studio and from code (using LINQ to SQL).
EDIT 2 (2016-05-10): It seems there is different problem - on every table with more than let's say 10000 records it throws some silly error. On some other table it throws:
An error occurred while executing batch. Error message is: Internal connection fatal error.`
It also disconnects me from database (in the bottom status row it says disconnected). SQL server is installed on remote server inside of local network.