Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 Convert char to datetime dmy instead of mdy

Author  Topic 

m-snel
Starting Member

6 Posts

Posted - 2011-04-26 : 08:02:49
Hello,

I have an old application that runs on sql server 2000. I managed to get it working with sql server 2005 (for my new 64 bit windows 7 computer). I only have one problem: when I execute a report which uses a date, the interpretation is wrong (mdy instead of dmy). I attached a screenprint with the error.

The application cannot be changed, so how can I make sql server 2005 express use the dmy format? I'm a complete novice with sql server so please keep that in mind when answering.

In front I'd like to thank you very much for your efforts to help me.

raghuveer125
Constraint Violating Yak Guru

285 Posts

Posted - 2011-04-26 : 08:28:02
You post your query or see this will help you

select convert(varchar,getdate(),101)---this is my systme current date
Output:-04/26/2011

select Convert(varchar,getdate(),103) ---this is my systme current date
Output:-26/04/2011



Raghu' S
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2011-04-26 : 08:28:24
a. invesitgate your regional settings - either your pc#'s version or the erver version
b. investigate the "set dateformat DMY" construct.
Go to Top of Page

m-snel
Starting Member

6 Posts

Posted - 2011-04-26 : 08:50:40
The query is embedded in the application itself (the application connects directly to sql server, both are installed and configured in the same setup). I see the picture with the error message is not embedded (how can I embed a jpg in my message)?

Changing the regional settings in Windows itself is not an option because other programs are affected (also the regional settings are correct for my region (Europe), so I shouldn't have to change that to US style).
Go to Top of Page

m-snel
Starting Member

6 Posts

Posted - 2011-04-27 : 03:36:24
There is no way to configure SQL server 2005 express that if it gets a date from a query it should interpret it as dmy instead of mdy? The mentioned application is the only application that uses the server so if a change goes throughout the server it isn't a problem.
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-04-27 : 07:14:34
Can you do this by changing the default language setting from English to British English as described here? http://msdn.microsoft.com/en-us/library/ms191448.aspx

That of course, assumes that the language setting currently is English and that you are allowed to change it.
Go to Top of Page

m-snel
Starting Member

6 Posts

Posted - 2011-04-27 : 08:05:22
That put me in the right direction, thanks!!!! I solved it by changing the language setting in the user with SQL Server Management Studio Express
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2011-04-28 : 07:21:30
Good to hear a collective effort had a useful result.
Go to Top of Page
   

- Advertisement -