Ian Boyd
Ian Boyd

Reputation: 256881

How do replication agents enable NOT FOR REPLICATION mode?

How do triggers/identity columns/check contrains marked as NOT FOR REPLICATION get bypassed when the user connecting is a "replication agent"?


If i am an SQL Server replication agent, and i connect to a server to perform replication, how do i indicate to SQL Server that i am a replication agent, so that not for replication rules are enabled on all tables?

Why am i asking?

Because (choose one):

Upvotes: 1

Views: 155

Answers (1)

Brandon Williams
Brandon Williams

Reputation: 3755

I believe this is done internally using sessionproperty():

declare @is_replicationagent bit
select @is_replicationagent = convert(bit, sessionproperty('replication_agent'))

Upvotes: 2

Related Questions