Solved

IDENTITYKEY

Posted on 2007-12-06
14
1,846 Views
Last Modified: 2012-06-27
Am getting the below error message when trying to do a bulk insert from the Publisher to Subscriber in SQL 2005. When I set up replication  @identityrangemanagementoption is set to auto
Msg 548, Level 16, State 2, Line 603
The insert failed. It conflicted with an identity range check constraint in database 'MTTTT, replicated table 'dbo.tb_CCMe', column 'ccmb_SID'. If the identity column is automatically managed by replication, update the range as follows: for the Publisher, execute sp_adjustpublisheridentityrange; for the Subscriber, run the Distribution Agent or the Merge Agent.
The statement has been terminated.
0
Comment
Question by:Richardsoet
  • 6
  • 6
14 Comments
 
LVL 17

Expert Comment

by:Daniel Reynolds
ID: 20421689
When I have set up replication in the past, a range needs to be selected for the identity fields of each database. I wonder if the count of your records has exceeded your ranges, and it would now require the ranges to be adjusted.
0
 

Author Comment

by:Richardsoet
ID: 20421782
Am using the below script but getting error

sp_adjustpublisheridentityrange  'MotivanoUKLiveWebCore',
    'tb_CCMemberBenefit'

Please rewrite it for me  my table name is 'tb_CCMemberBenefit'
my publication name is MotivanoUKLiveWebCore
Msg 21314, Level 16, State 1, Procedure sp_adjustpublisheridentityrange, Line 27
There must be one and only one of '@publication' and '@table_name' that is not NULL.
0
 

Author Comment

by:Richardsoet
ID: 20422217
Please how can i adjust ranges please please write the procedure to follow please
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 17

Expert Comment

by:Daniel Reynolds
ID: 20422694
Note the following in the useage deescription of the stored procedure to adjust your ranges.:  The last sentence is very important. (Only supply the publication or table name, NOT BOTH) You appear to be supplying both. Give it a whirl with only one.

sp_adjustpublisheridentityrange is used in all types of replication.

For a publication which has the auto identity range enabled, the Distribution Agent or Merge Agent is responsible for automatically adjusting the identity range in a publication based on its threshold value. However, if for some reason the Distribution Agent or Merge Agent has not been run for a period of time, and identity range resource have been consumed heavily to the point of threshold, users can call sp_adjustpublisheridentityrange to allocate a new range of values for a Publisher.

When executing sp_adjustpublisheridentityrange, either publication or table_name must be specified.
If both or neither are specified an error is returned.
0
 

Author Comment

by:Richardsoet
ID: 20422743
My problem is down to a table tb_CCMember which I was trying to do Bulk insert of 30000 records,
How do I resolve this problem
0
 
LVL 17

Expert Comment

by:Daniel Reynolds
ID: 20422776
0
 
LVL 17

Expert Comment

by:Daniel Reynolds
ID: 20422793
Have you tried
sp_adjustpublisheridentityrange  @table_name='tb_CCMember'
0
 

Author Comment

by:Richardsoet
ID: 20426435
How do I check the  identiy range to know am running out range on a table used for merge replication 2005
0
 

Author Comment

by:Richardsoet
ID: 20428362
is there any performance issue on replication when increase the  identity range???
0
 
LVL 17

Accepted Solution

by:
Daniel Reynolds earned 500 total points
ID: 20428865
The performance should not be affected at all.
Basically it just allows for each machine to save with a unique key (within the range).
Then when the merge is done, there are not any clashes between keys.

To view your key ranges, Open up MS SQL Server Mgmt Studio...Click the Replication Tree Node...Click the Local Publications Tree Node. Right Click the Publication you are interested in and select properties. In the next dialogue select Articles.. You can then select to view the specific table properties.
You should be able to look at your published articles and view the properties of each table to view the current identity range.
0
 

Author Comment

by:Richardsoet
ID: 20428980
does it affect the size of the table in any how if the identity is increased to maximum
0
 
LVL 17

Expert Comment

by:Daniel Reynolds
ID: 20429176
No, the data size of the column remains the same.

Remember though, that as you add more records your table size will grow. But the column that holds the identity remains the same.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL 2014 always on 31 58
SQL Activity Monitor detail 2 24
query linked sql table field from access 4 20
SQLCMD Output to file from xpcmd_shell 6 15
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question