|
|
Archives of the TeradataForum
Message Posted: Mon, 26 Feb 2007 @ 16:53:31 GMT
Subj: | | Re: Alter Table from Datype date to timestamp |
|
From: | | prahlad.patidar |
Hi,
Follow following steps:
1. Create table tbl (pi_col integer, Date_col date);
2. insert into tbl
values (1, date);
insert into tbl
values (2, date-2);
insert into tbl
values (1, date-3);
sel * from tbl;
3. Alter table tbl
Add timestamp_col timestamp(0);
4. update tbl
set timestamp_col = cast(date_col as timestamp(0));
5. alter table tbl
drop column date_col;
6. alter table tbl rename timestamp_col to date_col;
Hope it answers your question.
thanks & regards
Prahlad Patidar
| |