Friday, March 30, 2012
Merge replicaton: How to customize conflict detection, resolution?
We have a table Assets[asset_id, title] and a table
Asset_Versions[asset_id, version_no]. In addition, there are columns
added by replication for storing the ROWGUID.
After synchronzation, assume both Node1 and Node2 have
Assets(1,'XYZ') and Assets_Versions(1,1)
Before syncing again a new version is added at both nodes so that both
Node1 and Node2 have
Assets(1,'XYZ') and Assets_Versions(1,1)(1,2)
Now when it syncs again, the publisher will make another entry of
Assets_Versions(1,2) in the subscriber thus disturbing the business
logic because the Subscriber will now have 2 entries for version_no=2.
How can we make Replication identify this as a conflict. Can we write
a conflict resolver for such a situation?
Thanks and regards,
YashWhat is the PK on Assets_Versions? I think if it includes the id and version
,
then this will get identified as a conflict.
HTH,
Paul Ibison|||Actually I can't test it here but I believe I was incorrect earlier and that
you'll just get an error instead - perhaps you can test this for me. What I'
m
thinking of now is that you could just have id and version in the
asset_versions table and update rather than add new versions:
ID, version, guid
1,1,xxx
on next version we have:
ID, version, guid
1,2,xxx
If this fits in with your application it'll work as this will cause a
conflict if done on 2 nodes before syncing.
HTH,
Paul Ibison
Merge replicaton: How to customize conflict detection, resolution?
We have a table Assets[asset_id, title] and a table
Asset_Versions[asset_id, version_no]. In addition, there are columns
added by replication for storing the ROWGUID.
After synchronzation, assume both Node1 and Node2 have
Assets(1,'XYZ') and Assets_Versions(1,1)
Before syncing again a new version is added at both nodes so that both
Node1 and Node2 have
Assets(1,'XYZ') and Assets_Versions(1,1)(1,2)
Now when it syncs again, the publisher will make another entry of
Assets_Versions(1,2) in the subscriber thus disturbing the business
logic because the Subscriber will now have 2 entries for version_no=2.
How can we make Replication identify this as a conflict. Can we write
a conflict resolver for such a situation?
Thanks and regards,
Yash
What is the PK on Assets_Versions? I think if it includes the id and version,
then this will get identified as a conflict.
HTH,
Paul Ibison
|||Actually I can't test it here but I believe I was incorrect earlier and that
you'll just get an error instead - perhaps you can test this for me. What I'm
thinking of now is that you could just have id and version in the
asset_versions table and update rather than add new versions:
ID, version, guid
1,1,xxx
on next version we have:
ID, version, guid
1,2,xxx
If this fits in with your application it'll work as this will cause a
conflict if done on 2 nodes before syncing.
HTH,
Paul Ibison
Merge replicaton: How to customize conflict detection, resolution?
We have a table Assets[asset_id, title] and a table
Asset_Versions[asset_id, version_no]. In addition, there are columns
added by replication for storing the ROWGUID.
After synchronzation, assume both Node1 and Node2 have
Assets(1,'XYZ') and Assets_Versions(1,1)
Before syncing again a new version is added at both nodes so that both
Node1 and Node2 have
Assets(1,'XYZ') and Assets_Versions(1,1)(1,2)
Now when it syncs again, the publisher will make another entry of
Assets_Versions(1,2) in the subscriber thus disturbing the business
logic because the Subscriber will now have 2 entries for version_no=2.
How can we make Replication identify this as a conflict. Can we write
a conflict resolver for such a situation?
Thanks and regards,
Yash
What is the PK on Assets_Versions? I think if it includes the id and version,
then this will get identified as a conflict.
HTH,
Paul Ibison
|||Actually I can't test it here but I believe I was incorrect earlier and that
you'll just get an error instead - perhaps you can test this for me. What I'm
thinking of now is that you could just have id and version in the
asset_versions table and update rather than add new versions:
ID, version, guid
1,1,xxx
on next version we have:
ID, version, guid
1,2,xxx
If this fits in with your application it'll work as this will cause a
conflict if done on 2 nodes before syncing.
HTH,
Paul Ibison
Merge replicaton: How to customize conflict detection, resolution?
We have a table Assets[asset_id, title] and a table
Asset_Versions[asset_id, version_no]. In addition, there are columns
added by replication for storing the ROWGUID.
After synchronzation, assume both Node1 and Node2 have
Assets(1,'XYZ') and Assets_Versions(1,1)
Before syncing again a new version is added at both nodes so that both
Node1 and Node2 have
Assets(1,'XYZ') and Assets_Versions(1,1)(1,2)
Now when it syncs again, the publisher will make another entry of
Assets_Versions(1,2) in the subscriber thus disturbing the business
logic because the Subscriber will now have 2 entries for version_no=2.
How can we make Replication identify this as a conflict. Can we write
a conflict resolver for such a situation?
Thanks and regards,
YashWhat is the PK on Assets_Versions? I think if it includes the id and version,
then this will get identified as a conflict.
HTH,
Paul Ibison|||Actually I can't test it here but I believe I was incorrect earlier and that
you'll just get an error instead - perhaps you can test this for me. What I'm
thinking of now is that you could just have id and version in the
asset_versions table and update rather than add new versions:
ID, version, guid
1,1,xxx
on next version we have:
ID, version, guid
1,2,xxx
If this fits in with your application it'll work as this will cause a
conflict if done on 2 nodes before syncing.
HTH,
Paul Ibison|||A primary key or unique index on Assets_Versions should prevent such a
double insert/
--
relevantNoise - dedicated to mining blogs for business intelligence.
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
<yashgt@.gmail.com> wrote in message
news:1187325787.241826.116170@.m37g2000prh.googlegroups.com...
> We have a simple problem:
> We have a table Assets[asset_id, title] and a table
> Asset_Versions[asset_id, version_no]. In addition, there are columns
> added by replication for storing the ROWGUID.
> After synchronzation, assume both Node1 and Node2 have
> Assets(1,'XYZ') and Assets_Versions(1,1)
> Before syncing again a new version is added at both nodes so that both
> Node1 and Node2 have
> Assets(1,'XYZ') and Assets_Versions(1,1)(1,2)
> Now when it syncs again, the publisher will make another entry of
> Assets_Versions(1,2) in the subscriber thus disturbing the business
> logic because the Subscriber will now have 2 entries for version_no=2.
> How can we make Replication identify this as a conflict. Can we write
> a conflict resolver for such a situation?
> Thanks and regards,
> Yash
>sql
Merge Replication: Insert Trigger ONLY when replicating
I have a scenario where clients enter data into a MSDE local database on
their laptop. I would like to add a trigger on that table that fires only
on the Server (SQL2K Ent.) when they are synchronizing when a new records
has been inserted. By looking at the Merge trigger automaticcaly generated
on the table, I found something interesting:
"if sessionproperty('replication_agent') = 1 and (select
trigger_nestlevel()) = 1"
Therfore, I've created my trigger like the following:
Create Trigger tg_Inserted On tblBlaBla FOR INSERT
AS
if not sessionproperty('replication_agent') = 1
return
Insert Into tblTest (Account_Code, Product_Code, DateCreation)
Select ins.Account_code, ins.Product_Code, GetDate()
From Inserted As Ins
I've done some test and everything works fine. However, before putting this
in Production, I was wondering if I absolutely need to put the "Select
trigger_nestlevel() ..." or not. I've read in the newsgroups and some are
saying you need to, some are saying you don't need to... Since it is a very
well documented feature, can anyone confirm me the proper way of doing this?
That would be greatly appreciated. Thanks.Nest level check allows to avoid ping-pong traffic from subscriber to
publisher and vice versa

But in your case that should matter only if you are also replicating table
tblTest
Regards,
Kestutis Adomavicius
Consultant
UAB "Baltic Software Solutions"
"Christian Hamel" <chamel@.NOSPAM.com> wrote in message
news:udebeQ7WFHA.2692@.TK2MSFTNGP15.phx.gbl...
Hello,
I have a scenario where clients enter data into a MSDE local database on
their laptop. I would like to add a trigger on that table that fires only
on the Server (SQL2K Ent.) when they are synchronizing when a new records
has been inserted. By looking at the Merge trigger automaticcaly generated
on the table, I found something interesting:
"if sessionproperty('replication_agent') = 1 and (select
trigger_nestlevel()) = 1"
Therfore, I've created my trigger like the following:
Create Trigger tg_Inserted On tblBlaBla FOR INSERT
AS
if not sessionproperty('replication_agent') = 1
return
Insert Into tblTest (Account_Code, Product_Code, DateCreation)
Select ins.Account_code, ins.Product_Code, GetDate()
From Inserted As Ins
I've done some test and everything works fine. However, before putting this
in Production, I was wondering if I absolutely need to put the "Select
trigger_nestlevel() ..." or not. I've read in the newsgroups and some are
saying you need to, some are saying you don't need to... Since it is a very
well documented feature, can anyone confirm me the proper way of doing this?
That would be greatly appreciated. Thanks.|||Great. I'm not replicating this table. Thanks for the information.
"Kestutis Adomavicius" <kicker.lt@.noospaam_tut.by> wrote in message
news:eVz8BD8WFHA.1796@.TK2MSFTNGP15.phx.gbl...
> Nest level check allows to avoid ping-pong traffic from subscriber to
> publisher and vice versa

> But in your case that should matter only if you are also replicating table
> tblTest
> --
> Regards,
> Kestutis Adomavicius
> Consultant
> UAB "Baltic Software Solutions"
>
> "Christian Hamel" <chamel@.NOSPAM.com> wrote in message
> news:udebeQ7WFHA.2692@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I have a scenario where clients enter data into a MSDE local database
on
> their laptop. I would like to add a trigger on that table that fires only
> on the Server (SQL2K Ent.) when they are synchronizing when a new records
> has been inserted. By looking at the Merge trigger automaticcaly
generated
> on the table, I found something interesting:
> "if sessionproperty('replication_agent') = 1 and (select
> trigger_nestlevel()) = 1"
> Therfore, I've created my trigger like the following:
> Create Trigger tg_Inserted On tblBlaBla FOR INSERT
> AS
> if not sessionproperty('replication_agent') = 1
> return
> Insert Into tblTest (Account_Code, Product_Code, DateCreation)
> Select ins.Account_code, ins.Product_Code, GetDate()
> From Inserted As Ins
> I've done some test and everything works fine. However, before putting
this
> in Production, I was wondering if I absolutely need to put the "Select
> trigger_nestlevel() ..." or not. I've read in the newsgroups and some are
> saying you need to, some are saying you don't need to... Since it is a
very
> well documented feature, can anyone confirm me the proper way of doing
this?
>
That would be greatly appreciated. Thanks.>
|||I think it is to prevent recursive triggers from causing duplicate entries
in msmerge_contents. I could be wrong here.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Christian Hamel" <chamel@.NOSPAM.com> wrote in message
news:udebeQ7WFHA.2692@.TK2MSFTNGP15.phx.gbl...
> Hello,
> I have a scenario where clients enter data into a MSDE local database
on
> their laptop. I would like to add a trigger on that table that fires only
> on the Server (SQL2K Ent.) when they are synchronizing when a new records
> has been inserted. By looking at the Merge trigger automaticcaly
generated
> on the table, I found something interesting:
> "if sessionproperty('replication_agent') = 1 and (select
> trigger_nestlevel()) = 1"
> Therfore, I've created my trigger like the following:
> Create Trigger tg_Inserted On tblBlaBla FOR INSERT
> AS
> if not sessionproperty('replication_agent') = 1
> return
> Insert Into tblTest (Account_Code, Product_Code, DateCreation)
> Select ins.Account_code, ins.Product_Code, GetDate()
> From Inserted As Ins
> I've done some test and everything works fine. However, before putting
this
> in Production, I was wondering if I absolutely need to put the "Select
> trigger_nestlevel() ..." or not. I've read in the newsgroups and some are
> saying you need to, some are saying you don't need to... Since it is a
very
> well documented feature, can anyone confirm me the proper way of doing
this?
>
That would be greatly appreciated. Thanks.>
Merge Replication: Import Data
I have MERGE setup between SERVER A (Publisher)-- SERVER B (Subscriber).
in a table on SERVER A i am importing data from an excel sheet say 100
records. But these records are not reflecting on SERVER B even after merge
agent runs several time.
What would be be possible cause?
Thanks in advance.
Regards
Javed
When you use DTS by default triggers are not fired; in the options tab of
Transform Data Task Properties uncheck the Use Fast Load option to have your
triggers fired. You need to issue a sp_addtabletocontents 'tableName' to
replicate its contents.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Javed Iqbal" <javediqbal98@.hotmail.com> wrote in message
news:eyvd3r5CGHA.984@.tk2msftngp13.phx.gbl...
> Hi,
> I have MERGE setup between SERVER A (Publisher)-- SERVER B (Subscriber).
> in a table on SERVER A i am importing data from an excel sheet say 100
> records. But these records are not reflecting on SERVER B even after merge
> agent runs several time.
> What would be be possible cause?
> Thanks in advance.
> Regards
> Javed
>
Merge Replication: Dropping an article from existing Publication
How to drop a single article (TABLE) from merge replication keeping
publication intact.
Regards
Javed Iqbal
Javed,
unlike transactional, this is not possible. The nearest you can get is to
drop the publication hten recreate it without the article and do a nosync
initialization.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Hi Paul,
Thanks for the help.
Actually I want to change a column width in a replicated table which is
appearing at first position.
I can add dummy column then update dummy column with data. Then drop the
main column. Recreate main column with new size and update it. And finally
removing the dummy column using sp_repladdcolumn and sp_repldropcolumn.
But it will add the column at last position.
Is there any way to redefine column position on a replicated table?
OR
How to add a column at specific position?
Thanks in advance.
Regards
Javed Iqbal
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:ucTtJkYTGHA.4132@.TK2MSFTNGP11.phx.gbl...
> Javed,
> unlike transactional, this is not possible. The nearest you can get is to
> drop the publication hten recreate it without the article and do a nosync
> initialization.
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||Javed,
ideally the application is not dependant on the column position. We have no
TSQL to specify it, and the only practical way is to recreate the table. In
terms of merge, this would be a reinitialization. If at all possible, make
your application use column names rather than position numbers. As an
interim measure can you perhaps define a view?
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Thanks Paul for your prompt help.
Ideally my TSQL should refer column names but in my applications I am not
sure about what programmers have coded in TSQL. And it is not possible to
check those programs
.There are many reports based on this table hence I do not want to play with
the column position.
Correct me if I wrong at following.
Scenario - Merge Replication with NOSYNC.
I have only option to drop subscription / publication and recreate it with
the earlier generated scripts.
Regards
Javed Iqbal
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:%23x2oERZTGHA.1160@.TK2MSFTNGP09.phx.gbl...
> Javed,
> ideally the application is not dependant on the column position. We have
no
> TSQL to specify it, and the only practical way is to recreate the table.
In
> terms of merge, this would be a reinitialization. If at all possible, make
> your application use column names rather than position numbers. As an
> interim measure can you perhaps define a view?
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
|||Javed,
a nosync initialization would be ok. You could change the column position on
the publisher and subscriber before synchronising. In this case you'd take
over control of the identity range management. You could only use the
previous scripts if they were themselves defined as nosync.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
|||Yes Paul,
I am using NOSYNC since MERGE Replication is created / started.
Identities are ODD on Publisher EVEN on subscriber.
Any further inputs are highly appreciated.
Thanks a lot again Paul.
Regards
Javed Iqbal
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:ecN9afZTGHA.6084@.TK2MSFTNGP14.phx.gbl...
> Javed,
> a nosync initialization would be ok. You could change the column position
on
> the publisher and subscriber before synchronising. In this case you'd take
> over control of the identity range management. You could only use the
> previous scripts if they were themselves defined as nosync.
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>
>
>
Wednesday, March 28, 2012
merge replication without rowguid
I have a database that has Primary Key constraints on every table. Yet
when I run the replication wizard and try to configure merge
replication the wizard notifies me that it will create a rowguid on
the tables even though they already have a primary key.
anybody know how to avoid the rowguid column from being created?
regards,
Doron
what is the big deal with having rowguid column?
I am running the replication for 3 years with that column without any
prolem!
"DoronA" <doronal@.msn.com> wrote in message
news:OMPe$RgwEHA.824@.TK2MSFTNGP11.phx.gbl...
> hi,
> I have a database that has Primary Key constraints on every table. Yet
> when I run the replication wizard and try to configure merge
> replication the wizard notifies me that it will create a rowguid on
> the tables even though they already have a primary key.
> anybody know how to avoid the rowguid column from being created?
> regards,
> Doron
>
|||If your primary key is a unqueidentifier, then you can mark it as the
RowGuid column using ALTER TABLE, e.g.
ALTER TABLE dbo.MyTable
ALTER COLUMN MyPK ADD ROWGUIDCOL
Otherwise, you have to have a separate RowGuid column, as it's how
replication tracks the global identity of rows.
Paul
"DoronA" <doronal@.msn.com> wrote in message
news:OMPe$RgwEHA.824@.TK2MSFTNGP11t .phx.gbl...
> hi,
> I have a database that has Primary Key constraints on every table. Yet
> when I run the replication wizard and try to configure merge
> replication the wizard notifies me that it will create a rowguid on
> the tables even though they already have a primary key.
> anybody know how to avoid the rowguid column from being created?
> regards,
> Doron
>
merge replication without rowguid
I have a database that has Primary Key constraints on every table. Yet
when I run the replication wizard and try to configure merge
replication the wizard notifies me that it will create a rowguid on
the tables even though they already have a primary key.
anybody know how to avoid the rowguid column from being created?
regards,
Dorondoron_almog@.msn.com (Doron) wrote in message news:<995517bc.0411031605.30cf6318@.posting.google.com>...
> hi,
> I have a database that has Primary Key constraints on every table. Yet
> when I run the replication wizard and try to configure merge
> replication the wizard notifies me that it will create a rowguid on
> the tables even though they already have a primary key.
> anybody know how to avoid the rowguid column from being created?
> regards,
> Doron
Unless all of the replicas are read-only, how would you prevent the
same PK being allocated to two different rows in two different
replicas?
The solution you are being offered is to have rowguid be the primary
key - what's your proposed solution to the problem?
Merge Replication with identity keys
I am new in replication area . I have created a merge replication . The
tables which is present in source table has identity key, after creating
replication , I am able to add duplicate values in source as well as
destinations table having same identity values .
Secondly , When new table having identity values are added in article e.g
test1 ,Current Identity seed of test1 in different in destination database
.. I want to synchronise the data in 2 database . ie. when I am inserting
values in Test 1 table on DB1, identity seed should be taken correct seed
automatically and vice versa for destination table . Most of our tables are
containing identity keys , and all reports are based on that key .
Also ,pls let me know is there any helpful articles which simulatiing same
kind of problem.
Pls help me in this regard.
Regards,
Swati
Swati,
when you're ading the table, have a look at the table properties (this is an
elipsis button next to the table). There is a tab for identities. You can
select automatic range management here - ideally select a big enough range
so that there will not be any need to get another. This will ensure no
overlaps.
Rgds,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
Merge Replication with filters throwing error
Replication. I've filtered a table like this:
WHERE HOST_NAME() = convert(nvarchar(100), patientId)
"patientId" is uniqueidentifier type column, the primary key of
"Patient" table.
The error when synchronizing is the following:
"The row operation cannot be reapplied due to an integrity violation.
Check the Publication filter. [ Table = Appointment,Operation =
Insert/Update,RowGuid = {F64E1023-01AD-DA11-8ED9-0004E2B45615} ]}"
Table Patient is joined with table Appointment but I don't understand
the error.
I think this sentence worked in SQL Server 2000 and SQL Server E 2.0.
I would appreciate any help on this.
Regards.
I've also tried same filter for Appointment database, and here I don't
receive any error, but the filtering is not correctly done.
Can anybody tell me if the following filtering is correct: WHERE
HOST_NAME() = convert(nvarchar(100), patientId)
Be sure this filtering has correctly worked in the past.
Any ideas please?
Regards.
Friday, March 23, 2012
Merge Replication structural change
Hi
Created a table User with the fields of Uname varchar(30) and pwd varchar(30) in SQL server 2005.
I need to create a publication and Merge subscription with the below structural changes
User table with the fields of Uname varchar(25) and pwd carchar(30).
The publication table having the Uname varchar(30) but we change this to the subscription table as Uname varchar(25).
Is it possible? If you, please give the details.
Thanks.
Hello,
Is it intended to have different size of Uname? Otherwise, please try to ALTER COLUMN Uname to varchar(25) on the publisher side and this change should be populated to the subscriber side.
Thanks.
This posting is provided AS IS with no warranties, and confers no rights
|||Hi
Thanks for your reply.
I don't want to change this structural change in publication side. I need this change in subscription side only. so that i keep my Db with original structure and i changed the subscription db with modified structure.
|||as a workaround, you can alter table ..varchar(25), propagate the changes, then set @.replicate_ddl to 0, and alter your table back to varchar(30).|||Thanks Greg I got some idea from your reply.
If I have only one subscription means this is OK. but I am creating multiple subscription at any time.
Here is my complete requirement.
I have two publications. there is some difference in these two publications.
I am creating subscription from WinMobile device. I configure the publication name there. So that it refer the corresponding publication. These two publications are refer same tables but there is some article changes. I don't want to change the structure in both. I need to change this in one publication and the other one having the same as the DB structure.
The users subscribe the publication at any time. so we are not able to alter the tables each and every time.
Thanks again.
|||I would say you have a design issue then. Replication is used primarily to keep data in sync in multiple locations, if the column sizes must be different between data and source, you can try the workaround I mentioned above or fix your apps so that the schemas are always consistent.|||OK Greg. Thanks.Merge Replication structural change
Hi
Created a table User with the fields of Uname varchar(30) and pwd varchar(30) in SQL server 2005.
I need to create a publication and Merge subscription with the below structural changes
User table with the fields of Uname varchar(25) and pwd carchar(30).
The publication table having the Uname varchar(30) but we change this to the subscription table as Uname varchar(25).
Is it possible? If you, please give the details.
Thanks.
Hello,
Is it intended to have different size of Uname? Otherwise, please try to ALTER COLUMN Uname to varchar(25) on the publisher side and this change should be populated to the subscriber side.
Thanks.
This posting is provided AS IS with no warranties, and confers no rights
|||Hi
Thanks for your reply.
I don't want to change this structural change in publication side. I need this change in subscription side only. so that i keep my Db with original structure and i changed the subscription db with modified structure.
|||as a workaround, you can alter table ..varchar(25), propagate the changes, then set @.replicate_ddl to 0, and alter your table back to varchar(30).|||Thanks Greg I got some idea from your reply.
If I have only one subscription means this is OK. but I am creating multiple subscription at any time.
Here is my complete requirement.
I have two publications. there is some difference in these two publications.
I am creating subscription from WinMobile device. I configure the publication name there. So that it refer the corresponding publication. These two publications are refer same tables but there is some article changes. I don't want to change the structure in both. I need to change this in one publication and the other one having the same as the DB structure.
The users subscribe the publication at any time. so we are not able to alter the tables each and every time.
Thanks again.
|||I would say you have a design issue then. Replication is used primarily to keep data in sync in multiple locations, if the column sizes must be different between data and source, you can try the workaround I mentioned above or fix your apps so that the schemas are always consistent.|||OK Greg. Thanks.Merge Replication Status
What merge system table/s will give me the current status of my merge agent
i.e. the Replication Monitor window in Enterprise Manager displays a status
of 'suceeded' etc etc - where can I source this field from within the
Replication System tables?
Any help appreciated.
this script will get you details of the last history for
the merge agent called 'DH1791628-Northwind-
NorthwindStaff-DH1791628-3'.
It will have basic error info if an error occurs.
If you want the detailed error info, you'll need to join
to the MSrepl_errors table: MSmerge_history.error_id =
MSrepl_errors.id. This table typically has several rows
so you might want to use a cursor to add the text
together.
HTH,
Paul Ibison (SQL Server MVP)
[vbcol=seagreen]
declare @.agent_id int
select @.agent_id = id from msmerge_agents where name
= 'DH1791628-Northwind-NorthwindStaff-DH1791628-3'
select top 1 case
when rh.runstatus = 1 then 'Start'
when rh.runstatus = 2 then 'Succeed'
when rh.runstatus = 3 then 'In progress'
when rh.runstatus = 4 then 'Idle'
when rh.runstatus = 5 then 'Retry'
when rh.runstatus = 6 then 'Fail'
end as RunStatus,
'start_time' = convert(nvarchar(12), start_time, 112) +
substring(convert(nvarchar(24), start_time, 121), 11, 13),
comments
from MSmerge_history rh
order by timestamp desc
merge replication Sql server 2000 with SQLCE 2.0
On my SQL2000 I have 4 tables i want to merge (specific columns only ) in 1 table for Merge with my SQLCe ( the table will be use for read only)
Question 1:
What is the best pratice for keep the information update?
Run store procedure before the synch for re-populate the table?:confused: or Make Trigger INSERT, UPDATE, DELETE in the all 4 table?:confused: or a mixte?:confused:
Question 2:
Does someone know about some web site talk about this type of trick?
ThanksMay refer to this link http://msdn.microsoft.com/library/en-us/sqlce/htm/_lce_repl_intro_replication_architecture.asp which lists from SQL SErver CE books online.
http://csaw.biz/tips/sql-server-ce.php about KBAs with refers to CE.
http://www.winnetmag.com/SQLServer/Article/ArticleID/9004/9004.html
Merge replication schema changes
2005 express. My problem is, when we make table schema changes like adding
and removing columns, we drop and re-create the table. Is there any way that
this methodology can work with merge replication. I know the replication
trigger only track ATLER TABLE statements.
Thanks
Mark,
I'm not too sure what is happeng here. Are you saying that the ALTER TABLE
statement causes reinitialization? Or is a new snapshot being created? Or do
you manually drop the table, change the columns and then add the table
again? Just trying to get the gist of the issue

Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
|||Hi Paul,
We manually drop the table, change the columns and then add the table again.
The documentation I've read says that merge replication only tracks ATLER
TABLE statements. (Which we don't use).
Thanks for the quick response.
"Paul Ibison" wrote:
> Mark,
> I'm not too sure what is happeng here. Are you saying that the ALTER TABLE
> statement causes reinitialization? Or is a new snapshot being created? Or do
> you manually drop the table, change the columns and then add the table
> again? Just trying to get the gist of the issue

> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com .
>
>
|||Mark - not sure I follow - how do you make the changes to the table's
schema?
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com .
|||Hi Paul,
When we need to change a tables schema, we copy all the data out into a new
table with the new table structure. Then we delete the old table and rename
the new table to be the old table. If we want to add a new column to a table
we do not issue and ALTER TABLE add <column_name>... statement. We create a
new table with the new column in it and then copy the data over from the old
table. Update the new column with appropriate values. DROP the old table and
RENAME the new table. How can we get these schema changes propegated to the
subscribers.
Can we remove the table first from the publication. Drop and CREATE the
table and then add it into the publication again? What about pending
subscriber changes. Would they be lost in that case?
Thanks again.
"Paul Ibison" wrote:
> Mark - not sure I follow - how do you make the changes to the table's
> schema?
> Cheers,
> Paul Ibison SQL Server MVP, www.replicationanswers.com .
>
>
>
|||I would advise to use the inbuilt merge replication's support to ALTER
TABLES and propagate schema changes.
However I can also understand that it may be difficult to change the app. In
that case, yes you could drop the article and readd it after you change the
schema. The subscriber's unsent data will cause a problem in this case.
You may think that setting a pre_creation_cmd of 'none' to save the
subscriber's unsent changes. But remember that the schema is now different
between publisher and subscriber.
One thing you can do is to save off subscriber's unsent changes into a temp
table and then reinsert these rows after re-synchronizing the (new schema)
table.
Hope that helps
--Mahesh
[ This posting is provided "as is" with no warranties and confers no
rights. ]
"Mark (WHSCC)" <MarkWHSCC@.discussions.microsoft.com> wrote in message
news:63DB1088-15DE-4A3C-8FEE-A91C79D4AC9E@.microsoft.com...[vbcol=seagreen]
> Hi Paul,
> When we need to change a tables schema, we copy all the data out into a
> new
> table with the new table structure. Then we delete the old table and
> rename
> the new table to be the old table. If we want to add a new column to a
> table
> we do not issue and ALTER TABLE add <column_name>... statement. We create
> a
> new table with the new column in it and then copy the data over from the
> old
> table. Update the new column with appropriate values. DROP the old table
> and
> RENAME the new table. How can we get these schema changes propegated to
> the
> subscribers.
> Can we remove the table first from the publication. Drop and CREATE the
> table and then add it into the publication again? What about pending
> subscriber changes. Would they be lost in that case?
> Thanks again.
> "Paul Ibison" wrote:
Merge Replication Replicate Master and related tables
hi all,
Could we configure a merge replication such as replicate the master table and its all related tables (relation deep could be 1.)
We dont want to manually find master table relations and configure replication for the related tables.
please help for that configuration
kinds
No but why would you want to?|||No, replication wizard will not find and define all the FK dependencies for you, you have to do this yourself.|||Thanks StatisticsIO.com and Greg Y for your valuable help. |||In repl UI, there is capability to create a dynamic filter on the parent table and then automatically generate the join filters based on PK-FK, do try it out in the publication wizard.sqlWednesday, March 21, 2012
Merge replication question
we have a merge replication SQL Server 200 solution that worked fine so far;
2 days ago we put a new table in replication and something new, that we
didn't see before happened: for some reason not all the records where bcp in
the new table for one of the subscriptions and there is a sp_upd ...
(strange name after upd) that runs every 1 minute and 4 seconds.
Any ideas?
Thank you so much!
use the conflict viewer to determine if there were any conflicts which might
account for the missing rows. Also the sp_upd statement means that there
are changes on the publisher which are being performed on the subscriber.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Sorin" <Sorin@.discussions.microsoft.com> wrote in message
news:5674968D-EE90-4348-8705-83BA8659ED75@.microsoft.com...
> Hi,
> we have a merge replication SQL Server 200 solution that worked fine so
far;
> 2 days ago we put a new table in replication and something new, that we
> didn't see before happened: for some reason not all the records where bcp
in
> the new table for one of the subscriptions and there is a sp_upd ...
> (strange name after upd) that runs every 1 minute and 4 seconds.
> Any ideas?
> Thank you so much!
merge replication picking up tables not in the articles
to 2 which is the highest, and I see an error on a table that is not in my
articles being published but the repl is failing for it. the table exists in
my centralized database but not in my branch's. I can't find any references
to it in my replication.
can anyone tell me where I can look to see why repl is trying to delete from
this table?
TIA.
Can you script out your publication to see if it occurs there?
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"jaylou" <jaylou@.discussions.microsoft.com> wrote in message
news:1AC0EA95-F1EE-4630-9B99-1E66A7BAF026@.microsoft.com...
>I am having a strange issue with my merge repl. I have set my verbose
>level
> to 2 which is the highest, and I see an error on a table that is not in my
> articles being published but the repl is failing for it. the table exists
> in
> my centralized database but not in my branch's. I can't find any
> references
> to it in my replication.
> can anyone tell me where I can look to see why repl is trying to delete
> from
> this table?
> TIA.
>
|||I did try that and there were no references there either. Thats when I
decided to ask the experts

Anyway, I added the tables being referenced and all is well. You also
answer my other question about an incorrect Parameter, I did as you suggested
but it was still wrong, I removed it since the repl was working fine and my
repl was successful last night.
Thanks again for your help.
"Hilary Cotter" wrote:
> Can you script out your publication to see if it occurs there?
> --
> Hilary Cotter
> Looking for a SQL Server replication book?
> http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTS
> http://www.indexserverfaq.com
>
> "jaylou" <jaylou@.discussions.microsoft.com> wrote in message
> news:1AC0EA95-F1EE-4630-9B99-1E66A7BAF026@.microsoft.com...
>
>
Monday, March 19, 2012
Merge replication of Foreign keys
I need to add a new foreign key to a merge replicated table (It references
the PK in the same table). Is there anyway of replicating this to the other
subscribers without invalidating the snapshot or applying it separately on
each server?
AFAIK - no!
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"robham" <nospam@.co.uk> wrote in message
news:uXAUdaeiEHA.704@.TK2MSFTNGP12.phx.gbl...
> Hi.
> I need to add a new foreign key to a merge replicated table (It references
> the PK in the same table). Is there anyway of replicating this to the
other
> subscribers without invalidating the snapshot or applying it separately on
> each server?
>
|||Robham,
is the FK to be just a constraint? If so then I don't think it is possible
directly. I suppose you could use a combination of sp_repladdcolumn and
sp_repldropcolumn to achieve your aim but in some cases it is easier to
restart and do a noinit initialization.
If it is a new column, then sp_repladdcolumn should do it.
HTH,
Paul Ibison