Replication - Identity

Jul 18, 2000

Hi Everyone,
Can we use replication for two tables with identity columns
on SQL server 6.5 as well as 7.0

Thanks for your help
DP

View 1 Replies


ADVERTISEMENT

Identity Range Managed By Replication Is Full And Must Be Updated By A Replication Agent. Error Message Makes NO SENSE.

Mar 6, 2007

Hello,I'm getting the following error message when I try add a row using aStored Procedure."The identity range managed by replication is full and must be updatedby a replication agent".I read up on the subject and have tried the following solutionsaccording to MSDN without any luck.(http://support.Microsoft.com/kb/304706 )sp_adjustpublisheridentityrange (http://msdn2.microsoft.com/en-us/library/aa239401(SQL.80).aspx ) has no effectFor Testing:I've reloaded everything from scratch, created the pulications from byrunning the sql scripts generated,created replication snapshots andstarted the agents.I've checked the current Identity values in the Agent Table:DBCC CHECKIDENT ('Agent', NORESEED)Checking identity information: current identity value '18606', currentcolumn value '18606'.I check the Table to make sure there will be no conflicts with theprimary key:SELECT AgentID FROM Agent ORDER BY AgentID DESC18603 is the largest AgentID in the table.Using the Table Article Properties in the Publications PropertiesDialog, I can see values of:Range Size at Publisher: 100,000Range Size at Subscribers: 100New range @ percentage: 80In my mind this means that the Publisher will assign a new range whenthe Current Indentity value goes over 80,000?The Identity range for this table cannot be exhausted! I'm not surewhat to try next.Please! any insight will be of great help!Regards,Bm

View 1 Replies View Related

Replication And @@identity

Feb 22, 2006

I'we set up a replication between to sql 2000 servers(transactional replication), the problem is that user application is using select @@identity. I can se way this is a problem, but i cannot find an solution to this. Other than change the client app's code, which undesirable. Anyone with an suggestion how to solve this issue?

Regards,
Asbjorn :)

View 4 Replies View Related

Replication With Identity Field

Apr 17, 2000

1. Can someone tell me how to replicate the identity field.
2. When I use the 'NOT FOR REPLICATION' option, I keeps getting synx error. Here is the command:
alter table tusers alter column {userid INT} IDENTITY (1, 1) [NOT FOR REPLICATION]. Do you know why?
3. When I use the transaction replication wizard, why some of the table do not allow me to replicate(There is a key and cross symbol on the articles selection)?

Thanks

View 3 Replies View Related

Replication With IDENTITY Columns

Jan 16, 2001

(Long post)

I have a production database with about half the tables using
IDENTITY columns for PRIMARY KEYS. This system is configured as both
a Publisher and a Distributor. We are using Transactional Replication
without updates. The SQL Server Agent runs every hour to pick up any
changes and replicate them to the Subscriber (another SQL Server
machine configured as our failover server).

Both servers are running SQL Server 7.0 (original, no service packs)
under Windows NT 4.0 (SP4).

The failover server (the replication Subscriber) will only be used if
the primary server goes down. And hopefully, only for a short time
before the primary server comes back online. During the time that the
failover is actually being used, the application will not make any
changes to the database.

The IDENTITY values that are replicated need to stay with their
original values. The replication process CANNOT assign new values to
these columns when there are inserted into the database on the
Publisher (i.e. failover server)

My question is: According to the documention, I can add 'NOT FOR
REPLICATION' to the IDENTITY columns and the values will be
preserved. But a collegue of mine says that resets the IDENTITY
sequence on the subscriber and the 2nd time a row gets inserted on
the Publisher, the values get messed up. On his system, he calls a
stored procedure for the tables with IDENTITY columns, and in the
stored procedure, he executes a 'SET IDENTITY_INSERT OFF', then
INSERTS the row, then 'SET IDENTITY_INSERT ON'. He claims that this
approach solved his issues with IDENTITY columns.

Who is right? Do I have to create a stored procedure for replication
for every table with an IDENTITY column, or can I just add 'NOT FOR
REPLICATION' and SQL Server will handle the rest?

NOTE: Upgrading to SQL Server 2000 is NOT an option right now.
Although, if a Service Pack for 7 fixes this, that might be an option.

Thanks in advance for any help you can shed on this issue.

Dave

View 3 Replies View Related

Replication Of Identity Columns

Sep 8, 1999

We are trying to run replication from one server to another. Most of the tables in the publishing database have identity columns set. At one point the subscribing database had a match of identity columns and primary keys matching the publishing database. Obviously with a primary key set on the subscriber there would be conflicts with duplicate key inserts. We disabled the identity columms and droped the indexes and the data was able to replicate over. However, we discovered that the identity columns, which are used to generate id's on many of our tables, were not replicating over to the subscriber. In fact a null value was being inserted into the subsriber database.

Anyone seen this before? What, if there is one, is the solution?

Thanks,

Brad

View 1 Replies View Related

Identity And Merge Replication

Jan 31, 1999

Dear all,

How does an identity is affected by merge replication? Can sql control it so that there will be no replication conflict?

Here's the scenario, I have several tables with an identity column. the database resides in a server in the head office, there are several remote sites and remote users which will be running sql 7 desktop edition. Each remote will download only the data subset he is allowed to. Each site will be allowed add new rows on several table. Then they will update the head office server through replication.


Thanks

Reden

View 1 Replies View Related

Identity Columns In Replication

Jan 17, 2000

hi there.
I was wondering is there any way that you can use an Identity Column on both a subcribing and Publishing table in Replication,
I am receiving errors when I run Replication with Identity Columns,
Thanks in advance
Fin

View 1 Replies View Related

Identity – Yes And Yes (not For Replication) Data Type

Sep 1, 2004

Hi All,
I am new to MSSQL Server 2000. I am sorry if you think that this is silly question.

What is the difference between identity – yes and yes(not for replication)

What are two different situations where I should use identity – yes or identity - yes(not for replication)

Thanks in advance
rainbow11

View 3 Replies View Related

Identity Seed Gone Bad In Merge Replication

Aug 8, 2007

Sever: sql 2000
Replication: Merge

Issue:
I am having an issue with my audit table, This table is filled by Triggers on various tables through the database. All triggers are defied with "not for replication"

I have allocated 500k ranges, with 80% threshold to the publisher and subscriber databases for this table. The table only holds 225,000 records.

From time to time I get the following error "The identity range managed by replication is full and must be updated by a replication agent. The INSERT conflict occurred in database 'PublicationName', table 'AuditHistory', column 'AuditID'. Sp_adjustpublisheridentityrange can be called to get a new identity range."

When I looked into the issue yesterday I noticed that the identity range being used by replication was 334300001 -> 334799999, however the maximum value in the table was 334300096, meaning that only 95 records were inserted, which means it is no where near the 80% threshold.

Somehow the identity seed on the AuditHistory table had been changed to 334800104, which is outside the allowable range.

My question is what could cause the identity seed to get set to such a high number??

any thoughts would be great!

View 2 Replies View Related

Merge Replication Identity Ranges

Apr 5, 2008

I have a database table with a simple identity column. As a starting point... when I run the following queries... this is what I get:

SELECT Max(AliasID) FROM Account_Managers
1300006

DBCC CHECKIDENT ('Account_Managers')
Checking identity information: current identity value '1300006', current column value '1300006'.


Now... I set up merge replication, with the plan of allowing SQL Server to manage my identity ranges for me. I set up my ranges to be 100000 on the publication, 100000 on the subscriber, with a threshold of 80.

I would EXPECT to see the constraint
([AliasID]>(1300006) AND [AliasID]<=(1400006)) on the publisher and
([AliasID]>(1400006) AND [AliasID]<=(1500006)) on the subscriber.

However... what I do get is:

([AliasID]>(1300006) AND [AliasID]<=(1400006) OR [AliasID]>(1400006) AND [AliasID]<=(1500006)) on the publisher and

([AliasID]>(1500006) AND [AliasID]<=(1600006) OR [AliasID]>(1600006) AND [AliasID]<=(1700006))


Can anyone tell me why I get the OR... which essentially makes my identity ranges twice as large as they should be?

Thanks in advance.

- Alan D. Nelson

View 2 Replies View Related

Replication Issues With Identity Fields

May 12, 2007

Hi,
I am trying to replicate our application database (SQL server 2005) using transactional replication to another server. What I did was, took a backup of the live database and restored in backup server with same name. Then did a transactional replication. Issue is we have few tables having Identity columns defined as primary keys and 'Not for Replication' option of these tables is 'NO'. But once published, this becomes 'Yes' and also replication failed showing an error as

Explicit value must be specified for identity column in table <table name> either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column.

In the table article, for the parameter 'Action If name is in use', I have selected 'Drop the existing object and create a new one' (Also tried another option 'Delete Data'). How to resolve these issues.


Thanks in Advance,
Eldho Abraham

View 1 Replies View Related

How To Assign Identity Key Values In Replication

Sep 28, 2006

This is a very basic question on replication.

I'm having a central Server with SQL Server 2005 Standard Edition and Other sites with Sql Express Server 2005.

Other sites will also be adding New records and data will be replicated to Central server and from there it will be distributed to all sites.

Question is that if Other sites are also adding Records how i can assing Identity values in those databases. There are few restricitons on this :-

1. I don't want to use GUID.

2. Numbers should be sequential that is after 1000, 1001, 1002 etc. should come.

i thought of adding Negative Values in the primary key on other sites and then when data is replicated on central server then replace it with sequential key but i'm not clear on how to accomplish this.

any help will be highly appreciable.

View 3 Replies View Related

Replication :: Merge Identity Value Out Of Sync

May 16, 2015

We are running merge replication. My identity value was out of sync and the inserts stopped working. I Reseeded the identity value to 1500000 and ran "sp_adjustpublisheridentity" which set that to the new range (and table constraint) in the MSMerge file and table. I discovered my error and Reseeded the table back to 150000. How to I get the new range to be created when it is LESS than 1500000 in the MsMerge file???? Can I use the sp_restoreidentity....???

View 3 Replies View Related

Issue With Identity Columns After Replication Changes

Mar 28, 2007

Dear all,



We have an application that use merge replication between MSDE and Devices with SQL CE.



Due to a major application changes, we have to change our replication on all our workstation. Our process is the following:

- drop current replication

- recreate our replication



After first check our replication seems to work but after some test we have identify that all identity ranges have been reset on the workstation. As side effect, device start to reuse existing range and also existing value in the range.

- Have you ever encounter this type of issue?

- What can create it?

- Is our approach fully inappropriate?



Please let me know if you need more information,

Best regards,



View 3 Replies View Related

Identity Column Set Not For Replication And A Stored Procedure

Feb 2, 2015

I have a table, which is being replicated with the identity column set "not for replication" and a stored procedure, which is also replicated (execution) which inserts into this table. When the execution of the stored procedure happens, the replication monitor complains about identity value not being provided.other than removing the stored procedure from replication?

View 0 Replies View Related

SQL 2012 :: Merge Replication - Identity Columns

Nov 3, 2015

I was reading this:

"Adding an identity column to a published table is not supported, because it can result in non-convergence when the column is replicated to the Subscriber. The values in the identity column at the Publisher depend on the order in which the rows for the affected table are physically stored. The rows might be stored differently at the Subscriber; therefore the value for the identity column can be different for the same rows."

I don't understand...

If I create a table with an identity column and publish it. Can the values on the subscriber be different when the data is replicated?

Suppose I have a this table:

1 Name1
2 Name2
3 Name3

Column 1 is identity field and column 2 the name of employees.

If I publish this table , the data can be inserted on the subscriber .pe, with 2 name1 and 1 name3 and 1 name2?

What about if the identify fields is a primary key?

View 6 Replies View Related

Merge Replication Identity Range Error

Jan 8, 2008

Hi all i have setup merge replication with one publisher and 3 subscribers



The replication worked fine for about 2 months then i recieved the following error on all my subscriptions



The Publisher failed to allocate a new set of identity ranges for the subscription.
This can occur when a Publisher or a republishing Subscriber has run out of identity
ranges to allocate to its own Subscribers or when an identity column data type does
not support an additional identity range allocation. If a republishing Subscriber has
run out of identity ranges, synchronize the republishing Subscriber to obtain more
identity ranges before restarting the synchronization. If a Publisher runs out of identit
(Source: MSSQL_REPL, Error number: MSSQL_REPL-2147199417)
Get help: http://help/MSSQL_REPL-2147199417


I have updated my sql server to service pack 2

The publisher is sql Standard edition and the subscribers are Express edition



Any help would be great

Thanx

View 3 Replies View Related

Replication Disaster Recovery-Next Identity Seeds

Jan 22, 2008

We have implemented replication on SQL Server 2005 with 1 publisher and 1 snapshot (non-update) subscriber.

The purpose is for emergency disaster fail-over.

If the publisher (Primary) fails, then we switch the DNS so the subscriber (Secondary) becomes ‘live’ and we need it to be able to accept new records.

The problem is that the identity seeds start at 0 on the Secondary server - so no records can be input, as there are primary key violations.

We can set the increment value to -1 for all the seeds, and this works.

However there are config & replication issues with bringing up the database on the failed (Primary) server once it is restored and back online.

Does it really need to be this complicated?

Where are the ‘next identity seeds’ for all the tables in the database stored? Can they be restored on the database when fail-over occurs?

Or is there some setting in the Microsoft SQL Dba?

View 2 Replies View Related

Alter Identity Property Of A Column To NOT FOR REPLICATION

Jul 20, 2005

i need to alter all foreign keys in my database and uncheck the"Enforce relationship for replication" check box. Using the EM, Iextracted the code snippet below. unfortunately, when i run this testfrom query analyzer, then go back into the EM, the box is stillchecked.can anyone tell me what i am missing? any advice on unsetting thisattribute globally would be appreciated!BEGIN TRANSACTIONSET QUOTED_IDENTIFIER ONSET TRANSACTION ISOLATION LEVEL SERIALIZABLESET ARITHABORT ONSET NUMERIC_ROUNDABORT OFFSET CONCAT_NULL_YIELDS_NULL ONSET ANSI_NULLS ONSET ANSI_PADDING ONSET ANSI_WARNINGS ONCOMMITBEGIN TRANSACTIONALTER TABLE dbo.CustomerCustomerDemoDROP CONSTRAINT FK_CustomerCustomerDemo_CustomersGOCOMMITBEGIN TRANSACTIONALTER TABLE dbo.CustomerCustomerDemo WITH NOCHECK ADD CONSTRAINTFK_CustomerCustomerDemo_Customers FOREIGN KEY(CustomerID) REFERENCES dbo.Customers(CustomerID) NOT FOR REPLICATIONGOCOMMITthanks!!

View 4 Replies View Related

Print List Of Tables With Identity Row Set To NOT FOR REPLICATION

Jul 20, 2005

Does anyone know if there's an SQL command i can run that will listthe tables in a database that have an identity column set to NOT FORREPLICATION?Many thanksDan Williams.

View 2 Replies View Related

A Serious Bug In SQL-2005/2008 Replication: Loosing @@IDENTITY Value

Jul 6, 2007

Hello all!



There is a bug in SQL-2005/2008 Replication system, which may break data integrity, when using @@IDENTITY function to update FOREIGN KEY of some table.



When Merge replication is set up, and there is a table article with IDENTITY column in it, after inserting a new row in the table a value of @@IDENTITY function does not actually shows just inserted row's identity value.



This issue also generated when performing inserts via ADO.



For details, see my Feedback to Microsoft:

https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=286165







Also, there are other comments on this problem:

http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.data.ado&tid=dcb56477-15fe-413e-a90a-3e1816bc7375&p=1



https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=281682



https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=284124

View 5 Replies View Related

Identity Primary Field In Merge Replication

Jul 23, 2007

Hello I currently have a merge replication set up with 4 subscribers. A primary field for one of my tables is set to a integer indetity.



What Ive noticed is that depending on which database I enter data into, the indentity field (primary key) is set within a certain range I.e



On Server 1 - Values start from 1 then 2,3,4 etc etc



Server 2 - 24001, 24002, 24003 etc etc



Server 3 - 46001, 46002, 46003 etc etc



Server 4 - 68001, 68002, 68003



My question is what happens when these ranges eventually conflict? Do they automatically gain a different range such as 142 001, 142 002 etc etc?



Ive tried looking in SQL Help, and a quick search here, Im just after some confirmation before I implement this to my app.



cheers

View 1 Replies View Related

Replication :: Auto Identity Range Management?

Jun 14, 2010

I'm having a problem with merge replication.  My publisher and subscriber are SQL 2008 SP1, and my distributor is SQL 2008 R2.  Currently, there is no access to the subscriber data aside from the replication agents, so there are no data changes going on there, data is only being modified on the Publisher.  My plan was to get everything setup and do some internal testing before releasing the subscriber for use.

View 4 Replies View Related

Transactional Replication With Updateable Subscriptions And Identity Management

Oct 28, 2006

Replication Type: Transactional With Updateable Subscriptions
SQL Server Version: SQL Server 2005 Enterprise Edition
Publisher, Subscriber1 and Subscriber2 all on same SQL Server

Problem: I am trying to set up a transactional replication with two updateable subscriptions. All three databases are a carbon copy of each other. Every table to be replicated contains an identity key column. I've been asked to create the replication without assigning separate identity ranges for the publisher and the updateable subscriptions. In other words they want a continous ID range. Can this be done without managing identity ranges programatically outside of SQL Server itself?

Example:

Publisher inserts into table test1 in database1. This creates ID 100 for the record. ID 100 replicates to Subscriber1 (database2) and Subscriber2 (database3).
Subscriber1 and 2 identity seeds are then incremented to ID 100. So far, all three databases have the same identity seed in table test1. Subscriber1 inserts into table test1 in database2. This creates ID 101 for the record. ID 101 is replicated to Subscriber2 (database3) and to the publisher (database1).
Subscriber2 identity seed is then incremented to ID 101. However, the Publisher retains it's original identity seed of 100.
Insert into Publisher table test1 will fail since it will try to insert the identity seed of 101 which is taken.

I have tried identity range management Automatic and Manual. Both seem to have some limitations in managing identity seeds unless different identity ranges are assigned for publisher and subscriber.

Can someone recommend a solution to this problem? Can this be done natively in SQL Server 2005 replication. Or can some recommend another approach to make this work?




View 3 Replies View Related

Can I Set A Default Range For The Identity Values For Merge Replication?

May 8, 2006

Hello,

We have a couple of tables that can have quite a bit of data each day prior to replication. Can we increase the default values for a table for each subscription? For example we have a table called table1 and on the sqlexpress client they could enter in 10000 rows a day, on table2 it's just 100 rows a day. How can we increase the values to where we do not get the error for table1 stating that the insert failed because it conflicted with the identity range check constraint. Thanks in advance.

View 1 Replies View Related

Merge Replication - Setting Identity Range Management.

Feb 2, 2007

Hi All;

I am trying to set up Merge Replication on a database and want to set the IdentityRange Management to Auto for all my tables which use a Identity column.

In the wizard, on Article Properties Page, I can do this by selecting a Table, and going for its properties, but this is a tedious task as I have ~300 tables to set this property on.

Is there another way or a global location where I can set the property to true and even mention the ranges and the threshold, so that I dont have to pick each table and set it individually.

I am also aware of the fact that I can Generate a Script and modify it and run that, but I was looking for some way to do this in the wizard.

Thanks!

View 1 Replies View Related

Merge Replication With Anonymous Subscribers And Identity Columns

Dec 21, 2005

Hi,

I read the BOL on how the publisher will had out identity ranges to subscribers, but it was not clear if this was also the case for anonymous subscribers. Will merge replication with identity columns work with anonymous subscribers that sync via HTTPS?

Thanks,
Darrell Young

View 1 Replies View Related

Identity Columns And Date Columns On Transactional Replication

Sep 16, 2006

Hi,

I am planning to use transacational replication (instead of merge replication) on my SQL server 2000. My application is already live and is being used by real users.

How can I ensure that replicated data on different server would have exact same values of identity columns and date columns (where every I set default date to getdate())?

It is very important for me to have a mirror image of data (without using clustering servers).

Any help would be appreciated.

Thanks,

-Niraj

View 1 Replies View Related

Last GASP On Insert Row In Table With Identity Field, And Get New Identity Back ?

Jul 9, 2006

While I have learned a lot from this thread I am still basically confused about the issues involved.

.I wanted to INSERT a record in a parent table, get the Identity back and use it in a child table. Seems simple.

To my knowledge, mine would be the only process running that would update these tables. I was told that there is no guarantee, because the OLEDB provider could write the second destination row before the first, that the proper parent-child relationship would be generated as expected. It was recommended that I create my own variable in memory to hold the Identity value and use that in my SSIS package.

1. A simple example SSIS .dts example illustrating the approach of using a variable for identity would be helpful.

2. Suppose I actually had two processes updating these tables, running at the same time. Then it seems the "variable" method will also have its problems. Is there a final solution other than locking the tables involved prior to updating them or doing something crazy like using a GUID for the primary key!

3. We have done the type of parent-child inserts I originally described from t-sql for years without any apparent problems. (Maybe we were just lucky.) Is the entire issue simply a t-sql one or does SSIS add a layer of complexity beyond t-sql that needs to be addressed?



TIA,



Barkingdog

View 10 Replies View Related

Insert Row In Table With Identity Field, And Get New Identity Back

Jun 30, 2006

I want to insert a new record into a table with an Identity field and return the new Identify field value back to the data stream (for later insertion as a foreign key in another table).

What is the most direct way to do this in SSIS?



TIA,



barkingdog



P.S. Or should I pass the identity value back in a variable and not make it part of the data stream?

View 12 Replies View Related

T-SQL (SS2K8) :: How To Update Identity Column With Identity Value

Jan 25, 2015

I have table of three column first column is an ID column. However at creation of the table i have not set this column to auto increment. Then i have copied 50 rows in another table to this table then set the ID column values to zero.

Now I have changed the ID column to auto increment seed=1 increment=1 but the problem is i couldn't figure out how to update this ID column with zero value set to each row with this auto increment values so the ID column would have values from 1-50. Is there a away to do this?

View 6 Replies View Related

Identity...I Need To Get The Last (or Highest Number In Identity Column)...

Sep 19, 2005

Ok,I just need to know how to get the last record inserted by the highestIDENTITY number. Even if the computer was rebooted and it was twoweeks ago. (Does not have to do with the session).Any help is appreciated.Thanks,Trint

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved