Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase ««12

how to convert a MySQL date (linked server) to MS SQL? Expand / Collapse
Posted Thursday, February 14, 2013 5:30 AM


Group: General Forum Members
Last Login: Thursday, August 27, 2015 9:28 AM
Points: 11, Visits: 44
Hello! A wee bit of history, MySQL sometimes is used on a basis of "grab that web data, if they forgot the time do it anyhow!".

So, you may have to assign a special date/time that will not come up in normal use, like jan, 01 am, 01 mins after the how, 01 secs after the min, and keep on til you fill up all the fields.

Ugly as a mud fence, but that is one way.. now, if all of the times are important, I'll look around for something, this is first thing in the morning, and i'm not too awake yet!

hope it helps.. btw, I'm both a MySQL and SQL Server dba..

Post #1419998
Posted Tuesday, April 2, 2013 3:23 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, January 7, 2016 1:55 AM
Points: 1, Visits: 101
you could use DATE_FORMAT() to deal with this issue

SELECT T.field
OPENQUERY(LINKSERVER, 'SELECT DATE_FORMAT(t.field,''%X-%m-%d %H:%i:%f'') as field FROM table t ' ) AS T

the date '0000-00-00 00:00:00' will be replaced by ==> 00-00-0001 00:00:00
Post #1437764
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse