Wednesday, March 7, 2012

Automate inclusion of new tables?

I'm running snapshot replication, and there will often be new tables (and
other objects) added to the publisher that I'd like to automatically include
in the subscription. Any ideas on how to do this? I've thought about creating
a script that lists all the tables, etc., in a publisher, and then including
each of those in the subscription, but I have no idea if/how it would work.
Any help would be appreciated. Thanks!
You could use sp_addarticle and sp_addsubscription for each new table.
Finding the new tables depends on how you have this set up. If it is all the
tables, you could find tables from information_schema.tables which are not
in sysarticles, and use a cursor to iterate through and run the stored procs
ablve.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)

No comments:

Post a Comment