SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 Question on Transaction Replication
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

future_is_me
Starting Member

USA
14 Posts

Posted - 02/05/2013 :  15:11:13  Show Profile  Reply with Quote
Hello,

I am using SQL Server 2008 R2 SP1 SE. I have a question on transaction replication.In transaction replication is there a way that I can restrict the updates specific only to a column? Lets say if updates occur on source table(publisher database) on column a, column b and column c then I dont want any thing to get updated in the destination database tables (subscriber database). But if update occurs only on column d on source table(publisher database) then I want it to get updated in destination table too (subscriber database). Is this possible?

Thanks

sodeep
Flowing Fount of Yak Knowledge

USA
7174 Posts

Posted - 02/05/2013 :  16:38:56  Show Profile  Reply with Quote
Yes you can choose certain columns for which you want to replicate. If you donot want you can deselect.
Go to Top of Page

future_is_me
Starting Member

USA
14 Posts

Posted - 02/05/2013 :  17:53:04  Show Profile  Reply with Quote
quote:
Originally posted by sodeep

Yes you can choose certain columns for which you want to replicate. If you donot want you can deselect.



I think my question was confusing. I know we can replicate only certain columns from publisher to subscriber.

My question is:
when updates occur on publisher I dont want them to replicate to subcriber. I want to update subscriber data iff(if and only if) only a specific column value gets updated in publisher.

If there is a solution for it. can you please direct me to that url or guide me.

Thanks a bunch
Go to Top of Page

future_is_me
Starting Member

USA
14 Posts

Posted - 02/06/2013 :  09:47:21  Show Profile  Reply with Quote
I found the stored proc that needs to be modified. I am not sure where the changes have to be made and I need some help from experts on this. I am not good at TSQL. The reason I chose the replication was that the deployment option was available handy.

USE [CCF_SubscriberDB]
GO

/****** Object: StoredProcedure [dbo].[sp_MSupd_dbo2006] Script

SET QUOTED_IDENTIFIER ON
GO

ALTER procedure [dbo].[sp_MSupd_dbo2006]
@c1 datetime = NULL,
@c2 int = NULL,
@c3 int = NULL,
@c4 int = NULL,
@c5 int = NULL,
@c6 int = NULL,
@c7 money = NULL,
@c8 nvarchar(20) = NULL,
@pkc1 datetime = NULL,
@bitmap binary(1)
as
begin
if (substring(@bitmap,1,1) & 1 = 1))
begin
update [dbo].[2006] set
[Date] = case substring(@bitmap,1,1) & 1 when 1 then @c1 else [Date] end,
[col1] = case substring(@bitmap,1,1) & 2 when 2 then @c2 else [col1] end,
[col2] = case substring(@bitmap,1,1) & 4 when 4 then @c3 else [col2] end,
[col3] = case substring(@bitmap,1,1) & 8 when 8 then @c4 else [col3] end,
[col4] = case substring(@bitmap,1,1) & 16 when 16 then @c5 else [col4] end,
[col5] = case substring(@bitmap,1,1) & 32 when 32 then @c6 else [col5] end,
[col6] = case substring(@bitmap,1,1) & 64 when 64 then @c7 else [col6] end,
[col7] = case substring(@bitmap,1,1) & 128 when 128 then @c8 else [col7] end
where [Date] = @pkc1
if @@rowcount = 0
if @@microsoftversion>0x07320000
exec sp_MSreplraiserror 20598
end
else
begin
update [dbo].[2006] set
[col1] = case substring(@bitmap,1,1) & 2 when 2 then @c2 else [col1] end,
[col2] = case substring(@bitmap,1,1) & 4 when 4 then @c3 else [col2] end,
[col3] = case substring(@bitmap,1,1) & 8 when 8 then @c4 else [col3] end,
[col4] = case substring(@bitmap,1,1) & 16 when 16 then @c5 else [col4] end,
[col5] = case substring(@bitmap,1,1) & 32 when 32 then @c6 else [col5] end,
[col6] = case substring(@bitmap,1,1) & 64 when 64 then @c7 else [col6] end,
[col7] = case substring(@bitmap,1,1) & 128 when 128 then @c8 else [col7] end
where [Date] = @pkc1
if @@rowcount = 0
if @@microsoftversion>0x07320000
exec sp_MSreplraiserror 20598
end
end

GO


Thanks,
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000