简体   繁体   English

将数据从txt文件导入IBM netezza SQL数据库时出错

[英]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. 我想将数据从txt文件(9 KB)加载到Aginity工作台中的SQL IBM netezza数据库。

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: SQL查询为:

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 谢谢

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. 在Netezza中,“导入数据”选项的其他功能已被打破。 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. 如果要导入的文件包含逗号或双引号,请使用\\\\"对其进行转义\\,因为您将\\用作ESCAPECHAR参数值。

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. 提供标题(用于可见性)和至少一行导致此错误的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM