.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

transactional replication with identity column

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :Sql Server

Dear friends,

I have a transactional replication between A and B where A replicates its data into B . the schema of A and B are EXACTLY same. I have a table "t" in both databases which has an IDENTITY column with name "c" and it is set to be NOT FOR REPLICATION in both databases. Indeed I have "A.t.c " and "B.t.c " columns. Also I should mentioned that I never do any changes in B.t table. It should just get the last data from A.t (but because of some reasons I need to have a same schema).

I do the following steps :

1- Add a new row to A.t . (and see the added row in B.t after a few seconds either )

2- update this added row's c2 column (not the c which is  the identity and PK column)

3- an exception I receive in Replication Monitor which says I cannot update the B.t.c column because it is an Identity column!!!... (I checked the related MS's related update stored procedure)...

the question is why it wants to update the Identity column which is not needed indeed!?

View Complete Post

More Related Resource Links

Transactional Replication Identity column difference in SQL 2008


Hello All,

I have a Pull Transactional Replication in SQL 2000.

To enable the copying of Identity columns, my subscriber Insert stored procs are modified to mark


In the end, I set it to Off.

The environment is stable for 2 years. Now we are upgrading to SQL 2008.

Do I still need to do the above step?

I have noticed that SQL 20088 is even updating Subscriber table for schema changes also.

I am not sure if MS took care of that issue in SQL 2008.

Please let me know your inputs.



Dropping a column in publication without affecting transactional replication

I have set up Transactional Replication ONLY from database A  in server 1 (Publisher) to Database B in server 2 (Subscriber). I didnt set up snapshot replication but the database B was restored after taking backup of database A. Replication is fine now. But, I need to drop one column which is a primary key in one table(foreign key in another table :)) in Publisher without causing any issues to the replication. BTW, I am using SQL SERVER 2008 R2. Can someone please tell me how to do this?

Changing the column width in Transactional Replication

I changed  the column width on the publisher and all of sudden my replication failed saying unable to insert identity value.And finally I had to remove the article from the publisher.
How can I increase the column width of table without any impact  thats published as article in Transactional Replication?

After Merge Replication Identity column was not generated Properly


HI All,


    I has been implemented Merge replication in sql server 2008, in that some tables Id locums are add 2000 and 20000 no add automatically incremented, why it was happens how to resolved this issues? if i want to get continues number what will it do, please help me in this ..... this is very urgent for me.




MSSQL Transactional Replication (Identity Seed)



Im doing a migration from server A to server B.

I used transactional replication. Everything replicated nicely, however, the primary key constraint. Identity had auto resetted to 1. (which is not correct).

The table was created as "NOT FOR REPLICATION" <-- is this the main cause? I cant do anything to the database, as i'm not the application owner.


    [abrev] [varchar](50) NOT NULL,
    [converted] [varchar](50) NOT NULL,
    [longtext] [varchar](50) NULL,
    [texttype] [varchar](50) NOT NULL,
    [abrev_id] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
    [abrev_id] ASC

now, how do i save the situation? should i mirror the table structure, then do a replication for data?

please advise.

thanks Shawn

Transactional replication: Updates to one of my columns (sometimes) does not get replicated from the

hi, This is my scenario: I have a varchar(max) column on a table that is replicated to other servers. I have a stored procedure that does and update to this column and other columns on the table. This is done inside a transaction that also includes other updates. When I call the stored procedure, this one varchar(max) column's value is not replicated. When I just run the single update statement on its own, the value is replicated. Anyone know something about this? Thanks!    

transactional replication and sp_MSupd tables

Hi thre, My target server keeps running sp_MSupd sp for different values in profiler and synch status shows "delivering replication commands" I keep waiting but this never ends. and ultimately we run a snapshot and it can't be applied. So recreate the whole replication again. It runs fine for a while but again, the sp_MSupd sp starts running on the target server and the replication goes down again. I don't know how to fix this. any advices?   Regards

transactional replication falling behind. millions of transactions in sp_brosereplcmds

Hi, Hi All, we have transactional replication set up with all the agents running at source database. The synchronization status is stuck at "delivering replication transactions". The replication latency in replication monitor says excellent. when I check sp_browsereplcmds. it ever ends. It has over more than millions of rows of output. We were having trouble with this replciation recently because at the source db. they run a large batch. So we decided to schedule snapshot agent to run exactly after that batch but the snapshot doesn't seem to helping out with the latency. what should be done to resolve the issue. Please help. thanks.

Replication and auto Identity Increment

We want to have two SQL server working on the same data at the same time (SQL Server 2008). I've been told that the auto ID's will stop working (the identity option). I'm not sure how true this is or what is the best replication to use for this.   Thanks

Fetch Identity column just after inserting a row in table

Hi, Please help me with this question. I have a table and I insert a row into it. How can i select the latest inserted row? Can the 'inserted table' keyword be used outside trigger? ( I mean can we use it in above scenario?? If yes how)   Thanks in advance Tiya

getting an e-mail notification when a transactional replication stucks

Hi all, I've SQL Server 2005 and a transactional replication scenario with one puplisher and 11 subscribers. Sometimes one of the subscriptions fails and a manual operation is required. Is there a way to get an e-mail notification whenever the replica fails or stucks or simply degrade its performances?

XML Column containing single quote causes replication error

We have SQL Server 2005 transactional replication set up, and some of our tables have XML datatype columns.  We have run into an issue with the following error in the publication: Incorrect syntax near 's'. (Source: MSSQLServer, Error number: 102) Get help: http://help/102 Looking at the distribution database, I was able to extract the offending command, and it turns out that the XML column has a single quote (') embedded in it, and the command that was generated for inserting the row into the subscriber table has bad syntax because of the single quote (i.e., it is not escaped).  One interesting note is that the single quote happens to also show up in a non-XML column, and the command segment for that column was generated correctly (it was escaped). Is there a workaround / solution for this?

Issue with transactional replication on SQL 2005 SP3 using row filters with bit columns

We recently upgraded from SQL 2000 to SQL 2005 SP3 and I am noticing something that I think is a bug with replication from a publication that has an article in it with row filters.  It seems to be that if the row filter has columns that are bit datatype and that column is updated on the publisher to cause the row filter to exclude it, it is not removed from the subscriber.  If you update a column that is part of the row filter that is not a bit datatype it works as expected.  I can reproduce this in a test environment with a small base table.  In production this is resulting in an occasional 20598 error "The row was not found at the Subscriber when applying the replicated command". Is anyone aware of a hotfix that addresses this? I can think of a few work arounds but the table is rather large and I really would like to avoid having to pull replication, re-snap or changing datatypes on the base table etc. Any suggestions are greatly appreciated.  Thanks!

set reinitialization period on Transactional replication

How do you set the parameters on Standard Transactional Replication to Reinitialize after a certain period of time? Thank you.

Why are Identity columns automatically marked as "NOT FOR REPLICATION" for non-updateable Transactio

Hi, Replication has been a blind stop for me. I've always tried to avoid it. Anyway, I've got (non-updatable) transactional replication of data from a production database (SQL2008 R2) into a reporting database (SQL2005 SP3). There are a handful of tables with Identity columns. Looking at the Article table properties of the tables in question, I can see that "Identity Management" is set to Manual (and greyed so not changeable). Also the Identity columns of the source tables are now marked as NOT FOR REPLICATION. When I look at the replica tables, I can see that they also have an Identity on the Primary Key column. Looking at the "sp_MSins" procedures, I can see that the procedure does include the column with the Identity on it in the INSERT statement. So, having look at all this, I'm more confused that before. But, the number 1 vitally important thing for me is that the values in the Identity columns are "honoured" when replicated to the reporting database (i.e. as if I used the -E flag of BCP). And my first question is, is this the case? I've examined the data from a couple of tables, and currently it appears to be true, but I'm worried that this is just luck. Secondly, as the insert procedure includes the Identity column in the Insert (the the Identity is present in the replica), I'm assuming / guessing that the Distribution agen

Transactional Replication: Schema Option

1.I need to Replicate a db without replicating its constraints, only the tables. What is the best way to achieve this? 2.Need the Subcription(replicated db) to have the collation of the server being replicated to. Please explain how the options need to be configured. Thanks  

Row Filters using Transactional replication & joined criteria

Hi guys, I am after some advice as to my replication setup and what I can do with it.  I have only basic knowledge of replication but have had transactional replication setup for a while now which replicates a few of the main databases tables and it is working fine.  However we want to improve performance of our subscriber database, so I would like to use row filters for this. Imagine the setup of a database table for Questionnaires which has a Void bit field in it, and a table for Answers.  On the subscriber I want only non-void Questionnaires and their answers. So I set the row filter for the Questionnaire table to be "WHERE Void = 0", I think this works.  However, I don't think it works when I am working on the Answers table, my row filter would be "WHERE QuestionnaireID IN (SELECT QuestionnaireID FROM Questionnaires WHERE Void = 0). This works fine for the initial snapshot but not for following transactions. For example, if I made a Questionnaire not void then I'd expect that to make its way to the subscriber along with its answers. Or if I voided a Questionnaire I'd expect that Questionnaire and set of answers to be removed from the subscriber database. I have read that this type of filter that uses a subquery only works with merge replication, if my understanding is correct? So my question here is, can you validate my findings, is
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend