Question : Change the default Date format

Hello,

  We upgrade an application from SQL server 2000 to Sql Server 2005, now we facing problems with queries that have date fields for example

select * from table where datefield = '20/12/2007'

will return this error:
" Msg 242, Level 16, State 3, Line 1
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 value to '12/20/2007', it will work fine
 
I can use convert to change the format, but that will require to change the code

I would like force sql server to work with default format as 'dd/MM/yyyy' not  as American format, or something like auto start up with this command "set formatedate dmy"

Regards,
Mohammed

Answer : Change the default Date format

Contact Microsoft to see if there will be a change to the default language property..


FROM
http://groups.google.com/group/microsoft.public.sqlserver.setup/browse_thread/thread/d2b7eba6f98f03e/d0cc52e31155cfa8?lnk=st&q=SQL+Server+2005+british+english&rnum=10&hl=en#d0cc52e31155cfa8

The Language property of the server is the Default Product language and you
can not change it.

And i don't think the product language is the root cause of you issue.

The only way is to use the 'mm/dd/yyyy' format in your query string.

Also, you may submit feedback on this via the link below to improve our
product.
http://lab.msdn.microsoft.com/productfeedback/default.aspx

Hope you can understand this.

Wei Lu
Microsoft Online Partner Support
Random Solutions  
 
programming4us programming4us