开发者

Identity column problem in SQL replication

开发者 https://www.devze.com 2022-12-22 07:18 出处:网络
How can we transfer primary key (iden开发者_JS百科tity column) while replicating a database.You\'ll need to set the tables IDENTITY_INSERT to on and after everything is done turn it back off again.

How can we transfer primary key (iden开发者_JS百科tity column) while replicating a database.


You'll need to set the tables IDENTITY_INSERT to on and after everything is done turn it back off again.

SET IDENTITY_INSERT test ON

-- Inserts

SET IDENTITY_INSERT test OFF

But for more info and exceptions check this great article.
http://www.simple-talk.com/sql/database-administration/the-identity-crisis-in-replication/


If you're talking MySQL, a simple export/drop/create process should work just fine.


Remove the "identity" definition on your target table and you can copy directly from the source table. This will only work if the replication is one-way.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号