adding primary keys

would adding primary keys to some of the live data tables i have on my MSSQl database change anything to the data.  WOuld it affect the data structure or anything?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Daniel WilsonCommented:
No, it would not change the data.
If the data would violate that primary key, that is, the value is not unique, the creation of the primary key will fail.
It does change the structure because that PK is part of the structure.  It will not add fields, change data types, or any of that sort of structure change.
If you application already inserts only data that are unique on the fields in question, there will be no problem caused
If your application inserts "empty" rows, then updates them, adding primary keys may cause problems.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jim HornMicrosoft SQL Server Data DudeCommented:
For starters, why is there 'live data tables' without primary keys?  

If your table has column(s) that uniquely identify the row, then they should be defined as a primary key, as the use of primary keys and foreign key relationships greatly improve query performance vs. a table without a primary key (also known as a 'heap').

If you're at this point now then I highly recommend having an experienced data architect review your database and make recommendations.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.