sp_changedistributiondb (Transact-SQL)
Collapse the table of content
Expand the table of content

sp_changedistributiondb (Transact-SQL)

Applies To: SQL Server 2014, SQL Server 2016 Preview

Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Changes the properties of the distribution database. This stored procedure is executed at the Distributor on any database.

Topic link icon Transact-SQL Syntax Conventions

sp_changedistributiondb [ @database= ] 'database' 
    [ , [ @property= ] 'property' ] 
    [ , [ @value= ] 'value' ]

[ @database=] 'database'

Is the name of the distribution database. database is sysname, with no default.

[ @property=] 'property'

Is the property to change for the given database. property is sysname, and can be one of these values.




History table retention period.


Maximum distribution retention period.


Minimum distribution retention period.

NULL (default)

All available property values are printed.

[ @value=] 'value'

Is the new value for the specified property. value is nvarchar(255), with a default of NULL.

0 (success) or 1 (failure)

sp_changedistributiondb is used in all types of replication.

DECLARE @distributionDB AS sysname;
SET @distributionDB = N'distribution';

-- Change the history retention period to 24 hours and the
-- maximum retention period to 48 hours.  
USE distribution
EXEC sp_changedistributiondb @distributionDB, N'history_retention', 24
EXEC sp_changedistributiondb @distributionDB, N'max_distretention', 48

Only members of the sysadmin fixed server role can execute sp_changedistributiondb.

Community Additions

© 2016 Microsoft