SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


how to convert a MySQL date (linked server) to MS SQL?


how to convert a MySQL date (linked server) to MS SQL?

Author
Message
agnew-1142997
agnew-1142997
Valued Member
Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)Valued Member (61 reputation)

Group: General Forum Members
Points: 61 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..

J.
azzaoui.wahid
azzaoui.wahid
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 101
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search