Thursday, April 12, 2012

Convert MySQL timestamp field to SQL Server 2005 Date field

I have been Googling this for more than an hour now, without any luck.



Imported a MySQL database via CSV into MS SQL Server 2005, where a Tstamp (timestamp) field has been hassling me.



How do I convert the tstamp field into a SQL date field?





1 comment:

  1. I guess that field8047 is a varchar field.

    Try this:

    Select *,
    DATEADD(SECOND, cast(field8047 as int), '19700101') as datetime_created_calc
    From [Majestic].[dbo].[hdiyouth];

    ReplyDelete