Suppose we have one excel sheet that we have imported into a
table i.e. “Emp” after records are imported from excel to the table through
import wizard date changes to some decimal value now condition is to convert
that decimal value to the real date.
Query: select Id, CreatedDate from Emp
O/P:
|
Id |
CreatedDate |
|
101 |
42741.630556 |
Here we can see my CreatedDate column changed to some decimal value now we need to convert it into a real date i.e provided in an excel file.
Query: select Id, CreatedDate,
CAST(CAST(CreatedDate AS FLOAT) -2 AS datetime) as RealDate
from
Emp
O/P:
|
Id |
CreatedDate |
RealDate |
|
101 |
42741.630556 |
2017-01-06
15:08:00.040 |