OH YES! YET ANOTHER DATE CONVERSION PROBLEM.
Can anybody explain this mystery? ...
Query issued by client system:
VERSION ISO: UPDATE tblPatientDetails SET Dob = '1948-06-25'
VERSION USA: UPDATE tblPatientDetails SET Dob = '1948-25-06'
SERVER 1: (as reported by @@Version)
Microsoft SQL Server 7.00 - 7.00.623 (Intel X86) Nov 27 1998
MSDE on Windows 4.10 (Build 1998)
RESULT: VERSION ISO runs OK
RESULT: VERSION USA fails with error 242
SERVER 2: (as reported by @@Version)
Microsoft SQL Server 2000 - 8.00.194 (Intel X86) Aug 6 2000
Personal Edition on Windows NT 4.00 (Build 1381 : Service Pack 6)
RESULT: VERSION ISO fails with error 242
RESULT: VERSION USA runs OK
Notes:
1. Both server DB's have 'default language' set to 23. (UK English)
2. Error 242 is "the conversion of a char datatype to a datetime datatype
resulted in an out-of-range datetime value".
Is there something beyond 'default language' that affects date handling in SQL Server?
Why don't Microsoft first honour the ISO standard date before trying to guess at the
string format when converting to datetime (this would make life so much simpler)?
How does one construct dates in queries that will be handled consistently by
multiple SQL Server databases?
(I suspect this is the same question as Thread183-94972 from MarathonMan which
has not received a satisfactory answer - yet.)
Anybody help?