Monday, February 20, 2012

Replicating only the table structure...

Hi,
I'm configuring a merge replication. For some tables I don't need to
replicate data. It is enought to replicate only the structure. To do that I
set an horizontal filter "1 = 0" and this works but I wonder is it a more
efficient way to do that. The tables I'm replicating are very large...
Any suggestion is welcomed
Thanks in advance
Faustino Dina
If my email address starts with two 'f'
drop the first 'f' when mailing me.
Faustino,
you could use sp_addscriptexec or use a presnapshot script or a postsnapshot
script.
HTH,
Paul Ibison
|||be aware that sp_addscriptexec only works on unc deployed subscriptions. IE
it won't work with subscribers that downloaded their subscriptions using
ftp.
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:OkZSelFkEHA.636@.TK2MSFTNGP12.phx.gbl...
> Faustino,
> you could use sp_addscriptexec or use a presnapshot script or a
postsnapshot
> script.
> HTH,
> Paul Ibison
>
|||> you could use sp_addscriptexec or use a presnapshot script or a
postsnapshot
> Paul Ibison
Paul,
I've been looking at the Books Online and it looks these tricks doesn't help
in my problem. I have some tables that are required for the Sales
application that works locally. These tables hold temporary data that is not
required to be synchronized (merged) between publishers and subscribers. So
I thought I can win some time in the generation of the initial snapshot, and
in the subsequent merge synchronization between publisher and subscribers by
avoiding that the db replication engine did any action on that tables.
Strictly speaking these tables are not part of the publication, but I'd like
to include them in it 'cause they are strongly related to the rest of the
tables. When the Sales application require a change in the underlaying
tables (including those special tables) I'd like it to be replicated to al
subscribers.
Then it is not a problem of snapshot generation or running a script on the
subscriber, but the point is not to merge these table, just create an empty
table on the snapshot to be distributed
Faustino
|||Faustino,
I think I follow you. although admittedly it is not 'automatic' as far as
future column changes are concerned, you could still use this methodology.
When the table schema requires changing, you could a script on the publisher
then run exactly the same on the subscriber through sp_addscriptexec.
HTH,
Paul Ibison
|||If you have the bandwidth, using a horizontal 1=0 filter is an interesting
and effective solution.
You can also make a copy of those table which you need to replicate only
the structure into a separate database, then use Snapshot or Merge
Replication to push those "empty" tables to the subscribers. This
simplifies the Merge replication Agent since 909% of the time it works with
tables containing data and once in a while, need to include the empty
tables..
Chris Skorlinski
Microsoft SQL Server Support
Please reply directly to the thread with any updates.
This posting is provided "as is" with no warranties and confers no rights.

No comments:

Post a Comment