Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 26 Feb 2007 @ 16:53:31 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


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



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023