Wednesday, August 4, 2010

Timestamp to time

I recently encountered an issue, when I tried to typecast timestamp into time in SQL Assistant(it ran fine in bteq scripts),
Eg:
SELECT CAST((CURRENT_TIMESTAMP(0) + INTERVAL '7:00' HOUR TO MINUTE) AS TIME WITH TIME ZONE );
Is what I executed, and I got the following error:
SELECT Failed. 5402: WITH TIME ZONE is incompatible with specified data type.
 
My version details:
Teradata 12.00.00.0235
ODBC 13.00.00.04
 
Resolution:
Control Panel -> Administrative tools -> ODBC -> click configure on DSN -> Options -> Datetime format -> Set to AAA
(Mine was set to III)
 
I decided to write a blog entry, as I searched quite extensively on this issue, but was not able to find a resolution on internet. My DBA team helped me by filing TD service request. Hope this helps.
 
(P.S: Sorry for the discontinuity in performance enhancement suggestions, I will continue the series when I find some spare time)