adding a unique id and PK to existing tables

i have a few tables that were created in mssql 2005 server. due to my inexperience at the time, the tables were created without a primary key or unqiquely identifying column.

how can i add a column with a unique id (auto incrememnt?) to a table with existing data (around 600k rows)?

i need this to be a Primary key so that i can start using SQL Analysis services.

Many thanks,

Adam

6
задан Adam McC 26 January 2011 в 09:25
поделиться