Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Not able to set primary key


This question is answered.


Permlink Replies: 2 - Last Post: Jan 2, 2017 9:53 AM Last Post By: Jeff Overcash (...
John MacDonald

Posts: 179
Registered: 3/22/98
Not able to set primary key  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2017 6:02 AM
I have a small table that I am having a difficult time to set the primary key.

I have shut down the database,
created a field with the right size and set to not null
copied the other column data into it and when I try to set the primary key I get

"Attempt to store duplicate value ( visible to active transactions ) in unique index "RDB$PRIMARY19""

I committed the transactions - as far as I know

I have looked through all the tabs, I don't find an index with this identification.

Any Ideas?


--
JMAC out

John MacDonald

Posts: 179
Registered: 3/22/98
Re: Not able to set primary key  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2017 9:35 AM   in response to: John MacDonald in response to: John MacDonald
Ok, so I get it, duplicate values exist.

I would like to find a way to delete one of the duplicate values.

? Ideas ?

John MacDonald wrote:
I have a small table that I am having a difficult time to set the primary key.

I have shut down the database,
created a field with the right size and set to not null
copied the other column data into it and when I try to set the primary key I get

"Attempt to store duplicate value ( visible to active transactions ) in unique index "RDB$PRIMARY19""

I committed the transactions - as far as I know

I have looked through all the tabs, I don't find an index with this identification.

Any Ideas?


--
JMAC out


--
JMAC out
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: Not able to set primary key
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 2, 2017 9:53 AM   in response to: John MacDonald in response to: John MacDonald
John MacDonald wrote:
Ok, so I get it, duplicate values exist.

I would like to find a way to delete one of the duplicate values.

? Ideas ?

John MacDonald wrote:
I have a small table that I am having a difficult time to set the primary key.

I have shut down the database,
created a field with the right size and set to not null
copied the other column data into it and when I try to set the primary key I get

"Attempt to store duplicate value ( visible to active transactions ) in unique index "RDB$PRIMARY19""

I committed the transactions - as far as I know

I have looked through all the tabs, I don't find an index with this identification.

Any Ideas?


--
JMAC out


--
JMAC out

Well identifying them is fairly easy

select count(*), <cols in primary key>
from table
having count(*) > 1
group by <cols in primary key>

Deleting extras you can just write your delete statement that takes something
unique in addition to the primary key so it selects just one record or you grab
the RDB$DB_KEY and delete from that.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02