Skip to content

Set Publication Defaults

A batch of sp_changepublication calls that reset a publication to native sync with anonymous and immediate sync disabled.

Published Aug 12, 2008

My standard baseline for every new publication. Run this at the publisher database after creating the publication: it sets the sync method to native (with snapshot invalidation and reinitialization), disables anonymous access, and turns off immediate_sync so subscribers are not forced to apply changes synchronously. The final call re-applies the native sync method once more - harmless, but it keeps the setting authoritative.

USE Published_Database_Name
GO

EXEC sp_changepublication
	@publication='publication_name',
	@property='sync_method',
	@value='native',
	@force_invalidate_snapshot=1,
	@force_reinit_subscription=1
GO

EXEC sp_changepublication 
	@publication = 'publication_name', 
	@property = N'allow_anonymous', 
	@value = 'false' 
GO 

EXEC sp_changepublication 
	@publication = 'publication_name', 
	@property = N'immediate_sync', 
	@value = 'false' 
GO

EXEC sp_changepublication
	@publication='publication_name',
	@property='sync_method',
	@value='native',
	@force_reinit_subscription=1
An unhandled error has occurred. Reload 🗙