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
↧