Replication: SQL Server 2000 - Part 1 - Implementing Replication, Cont'd (Page 7 of 7 )
Data Considerations for Replication
Special consideration should be taken for some of the data types and properties during replication. These Data types and properties are:
Identity range management
Unique identifier and Timestamp data types
NOT FOR REPLICATION option
Identity Range Management
Value of a column marked as Identity is incremented automatically, when new rows are added to the column table. In replication, where publication contains identity columns, the following configurations can be used to manage Identity columns.
Use Auto Identity range management of SQL Server 2000
For example, you can set the Identity range of 1 to 500 for Publication ‘A’ at Publisher and 501 to 1000 for the same publication at Subscriber, with a threshold of 80%.
In this case, a newly inserted row at publisher will have Identity from 1 to 500 and a newly inserted row at subscriber will have identity from 501 to 1000.
When the threshold has reached 80%, a new identity range is used for the next inserts. In this case, if the identity value reaches 400 at the Publisher any new inserts after that will use the new identity range from 1001 to 1500. Similarly, if the Subscriber threshold reaches 800, any new inserts after that will have Identity range from 1501 to 2000.
The threshold value should be set carefully by evaluating the frequency of updates at the subscriber and synchronization schedule. Setting the threshold to a lower value will result in many unused Identity values.
The following system-stored procedures can also be used to set Identity range explicitly:
Use NOT FOR REPLICATION option when defining Identity columns
Identity ranges can also be managed by defining check constraint and the NOT FOR REPLCIATION option on Identity column. When an identity column is specified as NOT FOR REPLCATION, then its range should be provided programmatically. When this option is set, SQL server retains the original values set by the replication agent but continues to increment the value of the Identity column in a normal value, i.e. without resetting the Identity value.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.