Reputation: 359
I need to upload data from a text file to the Netezza table. It is not working because date format is not same between the Netezza table and Text file. As per Netezza table date format which should be date only but in text file it is datetime.
Is there any way, so that I can convert the datatime into date only while uploading.
AS_OF_DATE|ID
10/01/2015 00:00:00|40
INSERT INTO LND_FINANCE_CUSTOMER (AS_OF_DATE,ID)
SELECT * FROM EXTERNAL 'D:123.txt'
USING ( QUOTEDVALUE DOUBLE DELIMITER '|' MAXERRORS 4 DATESTYLE MDY DATEDELIM '/' MAXROWS 0 Y2BASE 2000 ENCODING internal REMOTESOURCE ODBC ESCAPECHAR '\');
Upvotes: 1
Views: 899
Reputation: 4295
If you force the file specification to timestamp the load should work fine. It will cast back to a date on the insert into LND_FINANCE_CUSTOMER
. See Code Below:
INSERT INTO LND_FINANCE_CUSTOMER (AS_OF_DATE,ID)
SELECT * FROM EXTERNAL 'D:\123.txt'
(AS_OF_DATE timestamp
,ID integer)
USING ( QUOTEDVALUE DOUBLE DELIMITER '|' MAXERRORS 4 DATESTYLE MDY DATEDELIM '/' MAXROWS 0 Y2BASE 2000 ENCODING internal REMOTESOURCE ODBC ESCAPECHAR '\');
Upvotes: 1