You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Leszek <le...@o2.pl> on 2007/12/04 22:18:37 UTC

import with unique and identity column

Hi all, I cannot find solution for my problem so I post here ;)

I'm trying to import file to derby database (10.3.1.4). This file was created through exporting from the same database structure.
I have table 'TABLE' with 1 identity column 'C1', 1 unique column 'C2' (name of product) and a couple other. 
Export command:
CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE (null, 'TABLE', 'd:/myfile.del', null, null, 'UTF-8');

Import command:
CALL SYSCS_UTIL.SYSCS_IMPORT_DATA (NULL, 'TABLE', 'C2,C3,c4,C5,C6', '2,3,4,5,6', 'D:/myfile.del',null, null, 'UTF-8', 0);

Best for me it would be if during import the base would ignoring duplicate rows(because I have unique column C2).
Life isn't easy :), so I receive en error (something like that):
The instruction was broken, because could cause the rising of the duplicate of the value.

Maybe I would delete unique property from C2 column and delete duplicate rows after import. But how?

Thanks for any help

Re: import with unique and identity column

Posted by Leechoo <le...@o2.pl>.

Leechoo wrote:
> 
> Maybe I would delete unique property from C2 column and delete duplicate
> rows after import. But how?
> 
> Thanks for any help
> 
> 

This block of code enable delete all duplicate rows:

delete from TABLE as P1
where P1.id > 
             ( select min(P2.ID) from TABLE as P2
               where P1.col1= P2.col1); 

-- 
View this message in context: http://www.nabble.com/import-with-unique-and-identity-column-tp14159742p14370245.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.