Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

BTEQ data format question/DATE format issue - response (2) by dnoeth

$
0
0
Hi Linda, you need all VarChars plus VarText format and then you simply cast to the appropriate datatype. Teradata is doing automatic type casts, but you might have to specify a FORMAT. The string with '-' can be directly casted when there's no leading or trailing hyphen (this is strange, but Teradata simply ignores hyphens in between digits as they might be part of a FORMAT). The date3 needs a FORMAT 'YYYYMMDD' and the time4 FORMAT 'HH:MI:SS', when it's returned like 3800 it's no time, it's an integer (and the colons have been ignored again) So this should load the data directly into target table with correct data types (or do the cast during a select): .REPEAT * USING (   num1 VARCHAR(11),   num2 VARCHAR(11),   date3 VARCHAR(8),   time4 VARCHAR(8)) INSERT INTO tab VALUES (   NULLIF(:num1, '#VALUE!'),   TRIM(BOTH '-' FROM :num2) (INT),   :date3 (DATE, FORMAT 'yyyymmdd'),   :time4 (TIME, FORMAT 'HH:MI:SS')) Dieter

Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>