| title | sp_changedistributiondb (Transact-SQL) | ||
|---|---|---|---|
| description | sp_changedistributiondb changes the properties of the distribution database. | ||
| author | markingmyname | ||
| ms.author | maghan | ||
| ms.reviewer | randolphwest | ||
| ms.date | 06/23/2025 | ||
| ms.service | sql | ||
| ms.subservice | replication | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
[!INCLUDE SQL Server SQL MI]
Changes the properties of the distribution database. This stored procedure is executed at the Distributor on any database.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sp_changedistributiondb
[ @database = ] N'database'
[ , [ @property = ] N'property' ]
[ , [ @value = ] N'value' ]
[ ; ]
The name of the distribution database. @database is sysname, with no default.
The property to change for the given database. @property is sysname, and can be one of these values.
| Value | Description |
|---|---|
history_retention |
History table retention period. |
max_distretention |
Maximum distribution retention period. |
min_distretention |
Minimum distribution retention period. |
NULL (default) |
All available @property values are printed. |
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.
:::code language="sql" source="../replication/codesnippet/tsql/sp-changedistributiondb-_1.sql":::
Only members of the sysadmin fixed server role can execute sp_changedistributiondb.