Groups | Blog | Home
all groups > sql server replication > september 2006 >

sql server replication : Change Identity to GUID


M
9/7/2006 11:05:39 AM
We have a 20GB database. Each table has a ID column with Identity and
PrimaryKey.
Up to Now we only do snapshot replication.
Now we need do merge replication.
Because the ID column only access by code, I am thinking change the ID
column with uniqueidentity data type.
but I do not know how to do it.
What I try to do is replication each table to a new table without the ID
Column, then add the ID column allow Null.
After save the table then run SQL something like:

Update Tb1 Set ID=NewID() where ID is null.

Then Change the ID Column do not allow Null.

Any better way to do it?

Thanks


M
9/7/2006 12:47:38 PM
Thanks,
We will need each sides can update the databases.

[quoted text, click to view]

Hilary Cotter
9/7/2006 2:43:24 PM
If you want to use merge replication for this it will create its own guid
column which you can use for your key. There are performance problems with
using a guid as your pk. I would advise you to add an identity property to
your id column, make that your pk and use transactional replication for
performance reasons.

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

AddThis Social Bookmark Button