April 13, 2007 at 1:57 pm
I am trying to setup transaction replication on an SQL2000 database. Some of the tables don't have primary keys so they are not replicating. I have been told to set the autonumber field as the primary key but not all the tables have an autonumber field.
Is there an easy way to insert the autonumber field into an existing table so I can use it as the primary key and replicate all my tables?
April 13, 2007 at 2:36 pm
ALTER TABLE tblname
ADD COLUMN myid IDENTITY (1,1)
Adding an IDENTITY column can take a while as it needs to number up every row in the table.
-Bill
April 16, 2007 at 2:08 pm
so that will add the column, does it make it the primary key and add the identity seed info in the bottom of the description.
Thanks for the info
Brian
April 17, 2007 at 4:50 am
Hi Brian,
No it will not make it a Primary Key. This is up to you to create. Either by script or in the table designer. You will, of course, see the Identity property and seed info in the table designer.
Regards
Graeme
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply