Reputation: 1623
I am using the DB2 import
command and would to import a delimited file. I would like to specify current timestamp
in one of the fields in the file, but I can't find a way to specify it. With or without quotes, the rows are all rejected for containing text rather than a valid timestamp. Is what I'm trying to do possible?
Upvotes: 0
Views: 814
Reputation: 18945
You did not provide any details about your import process, so I'm assuming you use the IMPORT
command. IMPORT
does not expects any expressions in the input file, it treats all input values as literals. Subsequently you cannot reference special register variables in the input file.
The INGEST
command, however, allows you to use expressions in the SQL statement, e.g.
INGEST FROM FILE <source_file>
FORMAT DELIMITED
(
$field1 INTEGER EXTERNAL,
$filler DATE 'mm/dd/yyyy',
$field3 CHAR(32)
)
INSERT INTO <table-name>
VALUES($field1, CURRENT TIMESTAMP, $field3);
Upvotes: 2