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

Can an article in Sql Server replication be based upon a query?

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

Problem

I am looking to replicate the results of a query, is that possible or do I need to rep the tables themselves?

Solution

Yes its definately possible. We use it all the time for replicating warehouse data to 53 different warehouses. The query you are talking about is called a replication filter.

Now listen up!!!
Do not put your query in the filter. Use a view instead.

That means you can easily alter the view at a later date as filters cannot be changed.
So you filter will be "select cols from vwUserFilter"

If you put the query in the filter and want to change it, you'd have to drop the publication and re-create it which is very painful.

Also see this link

Context

StackExchange Database Administrators Q#8399, answer score: 4

Revisions (0)

No revisions yet.