timestamp to timestamp(0)

Database
Enthusiast

timestamp to timestamp(0)

I want to insert data from source table to destination table.

In source table some column is timestamp (2006-01-25 00:00:00.000000)
and destination table is timestamp(0) (2006-01-25 00:00:00)

insert into destination ( dateA )
select dateB
from source

error:5404 datetime field overflow

I want to know how to change datatype.

Thank you.
2 REPLIES
Enthusiast

Re: timestamp to timestamp(0)

This one will work for you :

insert into destination ( dateA )
select cast(cast(dateB as varchar(19)) as timestamp(0))
from source

Enthusiast

Re: timestamp to timestamp(0)

Thanks TD_Arch