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
 General SQL Server Forums
 New to SQL Server Programming
 MSSQL datetime format

Author  Topic 

akronymn
Starting Member

6 Posts

Posted - 2009-04-22 : 14:34:06
I have an mssql database that I need to migrate to mysql. For some reason though any queries to any columns of type datetime are returned in French in the following format:

7/avr/2004 14:00

This also includes all the text of an SQL dump which not surprisingly makes mysql unable to read the dump from the MSSQL db. I've checked that my windows regional setting is set to English. I'm at a loss as to why this is happening or how to fix it. I just need them to be in mdy h:m:s format. One interesting thing I've noticed also is that if I look at the tables via the MSSQL Server Manager the dates are displayed as mdy h:m:s Thanks! -adam

nr
SQLTeam MVY

12543 Posts

Posted - 2009-04-22 : 14:45:07
That's just how the datetime is converted to character format.
It'll be due to the client.
How are you doing he export?

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

akronymn
Starting Member

6 Posts

Posted - 2009-04-22 : 14:50:10
I'm using a third party app called sqlDump. I don't think this is a client side issue because it is happening both with this dump as well as when I access the database via PHP scripts. Thnaks!
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2009-04-22 : 14:54:10
sql server will deliver a datetime which is a number.
I suspect it is something to do with your connection that is causing it to be converted to french.

How are you connecting to the server?

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

akronymn
Starting Member

6 Posts

Posted - 2009-04-22 : 15:12:31
Yep I've tried connecting 3 ways and here's what happens.

If I connect via PHP and then query the database I get the French dates.

When I run the sqlDump program it connects to the database and all the dates in the dump are in the French format.

If I run SQL Server Manager and do a query with its query editor I get back the dates in the expected 2004-03-10 10:45:00 format.

Thanks for looking into this, I'm stumped and appreciate all the help I can get! -Adam
Go to Top of Page

akronymn
Starting Member

6 Posts

Posted - 2009-04-22 : 15:18:46
Also just made sure the user's language was set to English by running:

SP_DEFAULTLANGUAGE @loginame = username, @LANGUAGE = english

in MSSQL Server Manager, which said it was succesful but all the results are still the same.
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2009-04-22 : 15:23:06
Try using the profiler to see what's executed.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

akronymn
Starting Member

6 Posts

Posted - 2009-04-22 : 16:13:21
So I've started using the profiler to investigate, but I'm not real sure exactly what I should be looking for. All I can seem to glean from it is the queries I execute and some info on how much system resources they used. Is there something more useful I can be looking for here? I've attached a screen shot of what I see when I run the profiler and execute a couple simple queries (involving a field of type datetime)... Thanks!
Go to Top of Page

akronymn
Starting Member

6 Posts

Posted - 2009-04-22 : 16:27:29
oops, I'm not seeing a way to attach a file...
Go to Top of Page
   

- Advertisement -