February 29, 2008 at 12:19 pm
HI, data has been accidentally removed from a table by a user and I am tryng to recover just that data from another database recovered to just before deletion.
Strange problem with duplicate key on a column user_attr_id defined as unique. When I try to insert a row where user_attr_id = 303 fails on duplicate key, but select on target table where user_attr_id = 303 returns 0 rows. Do not understand that
What is best code to insert only non duplicates from recovered table to source table.?
---------------------------------------------------------------------
February 29, 2008 at 12:40 pm
Perhaps you have duplicates in the source data.
February 29, 2008 at 12:50 pm
good point steve and I wish it were so, but select on 'where user_attr_id =303' returns only 1 row.
I am thinking I need some sort of outer join on the source and target tables to insert all but duplicates?
---------------------------------------------------------------------
February 29, 2008 at 1:02 pm
Are you sure the message is originated by your install operation (as opposed to an insert trigger on the table?) I've fallen for the duplicate row message only to realize it meant duplicate "in the history table", not the main table I was inserting into.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
February 29, 2008 at 1:11 pm
don't think so matt, how can I be 100% sure there are no insert triggers on this table?
---------------------------------------------------------------------
March 3, 2008 at 3:18 am
guys, thanks for your help. turns out there was another unique index defined on the table I missed because I was so concentrated on the primary key (to be fair to me it was late here............)
---------------------------------------------------------------------
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply