Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 6 of 6 total |
IMPORT |
Fri, Oct 23 2009 12:13 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Is there a way of saying "only import the new stuff" (eg the same primary key) or ignoring when there is a clash?
Roy Lambert |
Fri, Oct 23 2009 2:05 PM | Permanent Link |
"Daniel Kram" | Roy, the way I do it, is I have a key, like you suggested, and then I trap
the error: try execute query here except on E: EDatabaseError do begin sError := lowercase(E.Message); // some other error trapping here end else if ( (pos('duplicate',sError) > 0) or (pos('1004',sError) > 0) ) then // error updating/adding with a primary key begin // do nothing, this is okay. end; end; end; |
Sat, Oct 24 2009 3:37 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Daniel
Does that way simply halt the import with a user message or allow it to continue adding new data? Roy Lambert |
Sat, Oct 24 2009 7:39 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< Is there a way of saying "only import the new stuff" (eg the same primary key) or ignoring when there is a clash? >> You can use an ON ERROR trigger to eat such exceptions. Just create it before the import, and then drop it afterwards, or leave it created and make sure to disable it for normal operation. Just an empty trigger will do the trick: CREATE TRIGGER "ImportError" ERROR INSERT ON "MyTable" BEGIN END You could also use it to log the rows with errors to a different log/audit table. -- Tim Young Elevate Software www.elevatesoft.com |
Sat, Oct 24 2009 8:32 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
Hmm, interesting, and yet another of those cases where its "all off and damn well stay off" Roy Lambert |
Mon, Oct 26 2009 10:07 AM | Permanent Link |
"Daniel Kram" | Roy:
Since it catches the exception, it contiues importing. You may want to use Tim's idea with the trigger instead. Daniel |
This web page was last updated on Tuesday, September 17, 2024 at 04:19 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |