That happen because for at least one row in t, t.dateCreated
is bigger than 2147483647.
2147483647 is the max value of int data type in SQL Server.
2147483647 is 2038-01-19 03:14:07 in EPOCH time.
If t.dateCreated
is really EPOCH time and t.dateCreated
has values higher than 2038-01-19 03:14:07, that query is not going to work.
Maybe you should check:
- If
t.dateCreated
is really EPOCH time.
- The rows where
t.dateCreated
> 2147483647, just in case of some outliers.
Another thing to check, is if the EPOCH time is expressed in milliseconds.
In that case, the query should be
SELECT
DATEADD(S, t.dateCreated / 1000, CAST('1970-01-01' as datetime)),
t.user, t.machine
FROM
table t
But you are going to miss the milliseconds.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…