![](//teradataforum.com/imgs/ptdfw1.gif) |
![](//teradataforum.com/imgs/ptdfw2.gif) |
Archives of the TeradataForum
Message Posted: Wed, 03 Jan 2007 @ 11:33:43 GMT
Subj: | | Casting integer as Time |
|
From: | | Anomy Anom |
<-- Anonymously Posted: Wednesday, January 03, 2007 05:50 -->
Hello All,
Greetings for the new year. I have a INS-SEL query in which the target column is Time(0) and the source column is defined as Integer. Im
constrained to use a tool which connects through ODBC.
To insert into the Time(0) column, Im trying to cast integer as char and then casting that again to time(0). But I keep getting the error
Invalid Ansi time. Can you please suggest me a method to tackle this problem?
The query is as below. The column declared as integer is TRANS_TIME.
insert into EDSDV1_WORK.I$_EVENT
(
Event_Id,
Event_Activity_Type_Cd,
Event_Status_Cd,
Event_Status_Reason_Cd,
Event_Start_Dt,
Event_Start_Tm,
Event_End_Dt,
Event_End_Tm,
Financial_Ind,
EDW_Process_Id,
EDW_Source_Sys_Cd,
EDW_File_Id, IND_UPDATE
)
select
KEY11.Key_Event_Id,
'c',
DTC.TRAN_CD,
'N',
DTC.TRANSACTION_DT,
CAST(CAST( DTC.TRANS_TIME AS CHAR(10))AS time(0) ),
'9999-12-31',
'00:00:00',
DTC.FINANCIAL_IND,
KEY11.EDW_Process_Id,
KEY11.EDW_Source_Sys_Cd,
KEY11.EDW_File_Id ,
'I' IND_UPDATE
from EDSDV1_WORK.KEY_EVENT KEY11, EDSDV1_WORK.STG_SDTC_PSTLD_DTDWHTRN DTC
where (1=1)
And ((DTC.FINANCIAL_TRANS_NO=KEY11.Host_Acct_Num) AND
DTC.TRAN_CD=KEY11.Key_Type_Cd) ;
| |