Format of Datetime suddenly stop working
Posted on 2009-02-15
I have a SQL query in my dot net application, it used to work fine. The QUERY is:
Select * from OrderHeader where OrderType = 's'
and OrderDate >= '15/01/2006 12:01:00 AM'
Order by CustomerBranchID, OrderDate
The datetime "'15/01/2006 12:01:00 AM'" comes from "datetime" object in my dot net application. It used to work fine. However after last time I re-install my vista, vs and sql server, it stopped working. The error is:
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
If I change the date from "'15/01/2006 12:01:00 AM'" to "'10/01/2006 12:01:00 AM'", then it works. It looks like SQL treat my current datetime format as "MM/DD/YYY", rather than "DD/MM/YYY".
My question is: if I do not want to change my code a lot, is it possible just to change the configuration of my SQL server 2005?