Friday, February 27, 2015

Convert EPOCH timestamp to MSSQL (TSQL) timestamp

Easy conversion by below multiple dateadd calls is the only option available

select dateadd(ms, cast ([Column Name] AS BIGINT)%(3600*24*1000), dateadd(day, cast ([Column Name] as bigint)/(3600*24*1000), '1970-01-01 00:00:00.0'))
from

Note: Assuming [Column Name] is imported in varchar format