What is the "Replication" key for in a SQL Server connection string?

1k views Asked by At

In a SQL Server connection string you can specify a boolean value for the Replication key, for example:

Data Source=.;Initial Catalog=Example;Integrated Security=True;Replication=True;

The closest I can find to documentation of this is here, which says:

Gets or sets a Boolean value that indicates whether replication is supported using the connection.

But to me that doesn't really explain in enough detail what the setting actually does. Can someone give a deeper explanation of this?

I am working with databases that make use of replication, so it seems that this setting could be relevant.

1

There are 1 answers

0
Damien_The_Unbeliever On BEST ANSWER

Almost certainly you should not be setting this property, even though the databases are parties in a replication topology.

Setting this property to true means that any constraint or trigger that is marked as NOT FOR REPLICATION will not be enforced for that connection.

The only time I'd consider using it is if you're actually implementing a new "replication-like" mechanism other than one of the built in ones and you're constructing a connection string for your replication agent.

NOT FOR REPLICATION itself is used where it is desirable that certain constraints are maintained from an application usage perspective but, due to the nature of replication (where, say, only a subset of data is being replicated) the constraint would be violated during the replication process.