Cannot insert duplicate key row in object 'MSmerge_genhistory' with unique index 'unc1MSmerge_genhistory'
[ 2008-06-20 02:01:43 | 作者: progame ]
To fix this problem, I did the following:
1. First found the duplicate generation(s):
select generation
from msmerge_genhistory
group by generation
having count(*) > 1
2. Then I scripted an update from the msmerge_contents table just to be safe (all of my tables have the column "last_modified". You will need to change this to an appropriate column):
select 'update ' + a.name + ' set last_modified = last_modified where rowguid = ' +''''+ cast(c.rowguid as nvarchar(40)) + ''''
from msmerge_contents c
join sysmergearticles a
on c.tablenick = a.nickname
where generation = 4784219
3. Then I deleted 1 of the rows from msmerge_genhistory for that generation.
4. Replication worked fine after that.
5. Run the update script created in step 2 on the publisher to reissue the updates.
Step 2 and 5 might be unnecessary. But i included it just in case.
在第二步时, msmerge_contents 找不到这个generation的数据, 于是只好直接做第三步
评论Feed: /feed.asp?q=comment&id=1734
1. First found the duplicate generation(s):
select generation
from msmerge_genhistory
group by generation
having count(*) > 1
2. Then I scripted an update from the msmerge_contents table just to be safe (all of my tables have the column "last_modified". You will need to change this to an appropriate column):
select 'update ' + a.name + ' set last_modified = last_modified where rowguid = ' +''''+ cast(c.rowguid as nvarchar(40)) + ''''
from msmerge_contents c
join sysmergearticles a
on c.tablenick = a.nickname
where generation = 4784219
3. Then I deleted 1 of the rows from msmerge_genhistory for that generation.
4. Replication worked fine after that.
5. Run the update script created in step 2 on the publisher to reissue the updates.
Step 2 and 5 might be unnecessary. But i included it just in case.
在第二步时, msmerge_contents 找不到这个generation的数据, 于是只好直接做第三步
评论Feed: /feed.asp?q=comment&id=1734
您可能感兴趣的文章:
这篇日志没有评论.

