By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,291 Members | 3,096 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,291 IT Pros & Developers. It's quick & easy.

create a primary key in an existing table that currently does not have one.

P: n/a

I encountered problem when i tried to create a primary key in an
existing table which does not have one yet. There are too many records
in it and it's hard to find out which one is 'duplicated'.
I'm not sure whether, if there is any duplicate records in the table.
How can i solve this problem?

Thanks
leah

Nov 7 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
1)
create the primary key and let access tell you if there a conflict

2)
create a query that counts the number of times each value of the field
that will become the primary key exists, ie
SELECT tblItem.itemId, Count(tblItem.itemId) AS CountOfitemId
FROM tblItem
GROUP BY tblItem.itemId
ORDER BY Count(tblItem.itemId) DESC;
leah wrote:
I encountered problem when i tried to create a primary key in an
existing table which does not have one yet. There are too many records
in it and it's hard to find out which one is 'duplicated'.
I'm not sure whether, if there is any duplicate records in the table.
How can i solve this problem?

Thanks
leah
Nov 7 '06 #2

P: n/a
See:
Finding Duplicates in an imported DBF
at:
http://allenbrowne.com/xbase-04.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"leah" <le******@yahoo.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>
I encountered problem when i tried to create a primary key in an
existing table which does not have one yet. There are too many records
in it and it's hard to find out which one is 'duplicated'.
I'm not sure whether, if there is any duplicate records in the table.
How can i solve this problem?

Nov 7 '06 #3

P: n/a

Thanks for the replies.
It's working.
Thanks for the URL too.
Thanks again.

leah

Nov 8 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.