HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Replicating a Table Structure With no Data Using Merge Replication

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
mergewithreplicatingreplicationstructureusingdatatable

Problem

I am using merge replication with SQL 2012.

I have a table, and it would be useful to propogate that table to the subscribers, but just the table structure, not the actual data.

The data in the table is populated per session, i.e. when you log into the software data is added into the table, and then deleted when you exit the software.

What this means is that the data in the table shouldn't be replicated from publication to subscriber, or from subscriber to publication. But it would be good for the table structure to be replicated so that we don't have to run a script manually at the subscribers.

Solution

SQL Server's replication feature is intended to replicate data, not objects like tables. When configuring replication you may find that the slave table may not be a perfect copy of the master table; constraints and indexes may not be recreated on the slave side.

If you need the same table at the slave side, I believe that you should just run the script to create a table and forget about replication.

Context

StackExchange Database Administrators Q#19914, answer score: 2

Revisions (0)

No revisions yet.