Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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
Author
Message
Posted Thursday, February 14, 2013 5:30 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, October 24, 2014 2:00 PM
Points: 10, Visits: 41
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..

J.
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, December 11, 2014 8:09 AM
Points: 1, Visits: 93
you could use DATE_FORMAT() to deal with this issue

SELECT T.field
FROM
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