In SharePoint 2010, we have the built in functionality to enforce the uniqueness of the field. But yes do remember that the field must be indexed first before you want to set it as a primary key.Create a list in SharePoint 2010 site and then create a field that you want to have a primary key. Go to list settings. Go to indexed columns and choose that column to be indexed.You can index up to 20 fields per list as you can see in the screen shot. I have already created one index which is on Customer_ID field in the list.
At the time of creating a field then we have an option to enforce the unique value. This can be set only when you have made that column indexed. So if you have not indexed this column, SP 2010 will ask you to do it.

<div class="separator" style="clear:both;text-align:center;"></div>
After setting this field as unique key, then go ahead and add one value and try to add another with the same. It will not allow you to do following  message.
 

<div class="separator" style="clear:both;text-align:center;"></div>
<div class="MsoNormal" style="line-height:normal;margin:0 0 10pt;">Unique field is case insensitive. So if you have Leads and LEADS, it means same to the field. It is unique.it won’t allow you to save. Same is enforced even when you update the item.
Supported Column Types
• Single line of text
• Choice field (but not multichoice)
• Number
• Currency
• Date/ Time
• Lookup (but not multivalve)
• Person or Group (but not multivalve)
• Title (but not in a document library)
</div>