Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got data from sql source table like this '
0x000000000EFFE662
'. I have to convert it to datetime or date.

What I have tried:

select convert(datetime, column_name,103) + CAST(column_name as DATETIME),* from [dbo].[table_name]
Posted
Updated 17-Feb-20 2:27am

1 solution

You cannot convert a SQL timestamp to a datetime, unfortunately.
How to convert SQL Server's timestamp column to datetime format - Stack Overflow[^] gives a deeper insight about it.
 
Share this answer
 
Comments
Maciej Los 17-Feb-20 9:02am    
5ed!
phil.o 17-Feb-20 9:05am    
Thanks :)
Member 11776570 17-Feb-20 9:37am    
But still i can convert that data i have try all the solution of your given link.
It is giving error like this 'Arithmetic overflow error converting expression'
phil.o 17-Feb-20 9:41am    
Without knowing the exact SQL code you tried, the only thing that can be said is that what you tried to "convert" does not fit into the target type.
Member 11776570 17-Feb-20 9:47am    
I have tried this 'select convert(datetime,column_name,121),* from [dbo].[Table_name]'. It gives me this error 'Arithmetic overflow error converting expression to data type datetime.'

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900