user3601704
user3601704

Reputation: 763

error of importing data from txt file to IBM netezza SQL database

i would like to load data from a txt file (9 KB) to SQL IBM netezza database in Aginity workbench.

After creating the table:

I right-clicked the table and go to "import data" tab and chose "comma" as field delimiter and skip the first row for the header in the file.

The SQL query is:

INSERT INTO username.my_table   // the table has 12 columns and all are characters
SELECT * FROM 
EXTERNAL 'C:\\mypath\\my_file.txt'
USING
(
  DELIMITER ','
  LOGDIR 'C:\\temp'
  Y2BASE 2000
  ENCODING 'internal'
  SKIPROWS 1
  REMOTESOURCE 'ODBC'
  ESCAPECHAR '\'
)

But, I got error:

 Unable to export the data to a file. Error: operations canceled.

Why it is "export", I want to do import.

Any help would be appreciated.

thanks

Upvotes: 1

Views: 2266

Answers (1)

JustBeingHelpful
JustBeingHelpful

Reputation: 18980

Uncheck the double quote option, and remove all of your double quotes from the file itself. That's broken in Netezza among other functionality for the "Import Data" option. If the file you are importing contains commas or double quotes, just escape them with a \, or \" since you're using \ as your ESCAPECHAR argument value.

You should also remove the headers in the file before the import.

If that didn't work, can you please provide the contents of your file? Provide the headers (for visibility) and the data for at least one line that causes this error.

Upvotes: 1

Related Questions