Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: New to Interbase and IBConsole - Primary Index


This question is answered.


Permlink Replies: 2 - Last Post: Nov 13, 2016 12:35 PM Last Post By: John MacDonald
John MacDonald

Posts: 179
Registered: 3/22/98
New to Interbase and IBConsole - Primary Index  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 12, 2016 5:25 AM
Hello All:

I'm trying to set a primary key and apparently during the conversion from the BDE something has set an index that is blocking me from recreating a proper primary key.

I created a new field with not null.
Then I copied the contents to the new field from the old.
Then I dropped the old field
When I try to assign the primary key
Attempt to store duplicate value ( visible to active transactions) in unique index "RDB$PRIMARY8"
???
I am reading the documentation for Interbase, but, I have not found this type of information.

--
JMAC out

Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: New to Interbase and IBConsole - Primary Index
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 13, 2016 3:08 AM   in response to: John MacDonald in response to: John MacDonald
John MacDonald wrote:
Hello All:

I'm trying to set a primary key and apparently during the conversion from the BDE something has set an index that is blocking me from recreating a proper primary key.

I created a new field with not null.
Then I copied the contents to the new field from the old.
Then I dropped the old field
When I try to assign the primary key
Attempt to store duplicate value ( visible to active transactions) in unique index "RDB$PRIMARY8"
???
I am reading the documentation for Interbase, but, I have not found this type of information.

--
JMAC out


Make sure to be committing after doing the drop.

Also make sure the data doesn't have duplicates. do a

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

that will tell you if there is any duplicate data

--
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)
John MacDonald

Posts: 179
Registered: 3/22/98
Re: New to Interbase and IBConsole - Primary Index  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 13, 2016 12:35 PM   in response to: Jeff Overcash (... in response to: Jeff Overcash (...
Hello Jeff:

Sure enough there were duplicates in the field I need to use as my primary key.

Thanks for your help.

John

Jeff Overcash (TeamB) wrote:
John MacDonald wrote:
Hello All:

I'm trying to set a primary key and apparently during the conversion from the BDE something has set an index that is blocking me from recreating a proper primary key.

I created a new field with not null.
Then I copied the contents to the new field from the old.
Then I dropped the old field
When I try to assign the primary key
Attempt to store duplicate value ( visible to active transactions) in unique index "RDB$PRIMARY8"
???
I am reading the documentation for Interbase, but, I have not found this type of information.

--
JMAC out


Make sure to be committing after doing the drop.

Also make sure the data doesn't have duplicates. do a

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

that will tell you if there is any duplicate data

--
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