我正在使用DAT文件向表中插入多个条目。我如何知道哪些记录导致约束失败(例如重复约束)?我正在使用informix dbaccess加载条目。
以下是我如何加载它的示例代码:
load from 'table.dat'
insert into table (
col1,
col2,
col3
);
这是我得到的错误。它显示了sql代码从哪里失败但它并没有告诉我哪个特定的行失败了。
268: Unique constraint (test.tableconstraint) violated.
100: ISAM error: duplicate value for a record with unique key.
Error in line 1
Near character position 0
你有几个选择:
dbload
)代替DB-Access来加载数据。
DBLOAD Load Utility INFORMIX-SQL Version 12.10.FC6
Usage:
dbload [-d dbname] [-c cfilname] [-l logfile] [-e errnum] [-n nnum]
[-i inum] [-s] [-p] [-r | -k] [-X]
-d database name
-c command file name
-l bad row(s) log file
-e bad row(s) # before abort
-s syntax error check only
-n # of row(s) before commit
-p prompt to commit or not on abort
-i # of row(s) to ignore before starting
-r loading without locking table
-X recognize HEX escapes in character fields
-k loading with exclusive lock on table(s)
_vio
和_dia
的基表名称。尝试两者 - 我怀疑违规表是更好的选择,但两者都有效。