Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 26 Feb 2007 @ 09:25:54 GMT


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


Subj:   Re: Alter Table from Datype date to timestamp
 
From:   Gadodia, RahulKumar

Hi,

To change the date datatype column to timestamp column consider below mentioned table & steps:


Follow the below mentioned steps :

1. Add a column of Timestamp datatype -

     Alter table tblname
     Add timestamp_column timestamp(0);

2. Update table to set the timestamp_column as follows :

     Update tblname
     From
     (sel pi_column,cast(date_column as timestamp(0)) as dtcol from tblname )d
     Set timestamp_column = d.dtcol
     Where tblname.pi_column = d.pi_column;

3. Drop the date_column(if you don't need that any more)

     Alter table tblname
     drop Date_column;

Hope I answered your question !!


Regards,

RahulKumar Gadodia



     
  <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