| title | sp_add_agent_profile (Transact-SQL) | ||
|---|---|---|---|
| description | sp_add_agent_profile (Transact-SQL) | ||
| author | mashamsft | ||
| ms.author | mathoma | ||
| 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]
Creates a new profile for a replication agent. 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_add_agent_profile [ [ @profile_id = ] profile_id OUTPUT ]
, [ @profile_name = ] 'profile_name'
, [ @agent_type = ] agent_type
[ , [ @profile_type = ] profile_type ]
[ , [ @description = ] N'description' ]
[ , [ @default = ] default ]
The ID associated with the newly inserted profile. @profile_id is int and is an optional OUTPUT parameter. If specified, the value is set to the new profile ID.
The name of the profile. @profile_name is sysname, with no default.
The type of replication agent. @agent_type is int, with no default, and can be one of these values.
| Value | Description |
|---|---|
1 |
Snapshot Agent |
2 |
Log Reader Agent |
3 |
Distribution Agent |
4 |
Merge Agent |
9 |
Queue Reader Agent |
The type of profile.profile_type is int, with a default of 1.
0 indicates a system profile. 1 indicates a custom profile. Only custom profiles can be created using this stored procedure; therefore the only valid value is 1. Only [!INCLUDE ssNoVersion] creates system profiles.
A description of the profile. @description is nvarchar(3000), with no default.
Indicates whether the profile is the default for @agent_type. @default is bit, with a default of 0. 1 indicates that the profile being added will become the new default profile for the agent specified by @agent_type.
0 (success) or 1 (failure).
sp_add_agent_profile is used in snapshot replication, transactional replication, and merge replication.
Custom agent profiles are added with the default agent parameter values. Use sp_change_agent_parameter to change these default values or sp_add_agent_parameter to add additional parameters.
When sp_add_agent_profile is executed, a row is added for the new custom profile in the MSagent_profiles table and the associated default parameters for this profile are added to the MSagent_parameters table.
Only members of the sysadmin fixed server role can execute sp_add_agent_profile.
- Work with Replication Agent Profiles
- Replication Agent Profiles
- sp_add_agent_parameter (Transact-SQL)
- sp_change_agent_parameter (Transact-SQL)
- sp_change_agent_profile (Transact-SQL)
- sp_drop_agent_parameter (Transact-SQL)
- sp_drop_agent_profile (Transact-SQL)
- sp_help_agent_parameter (Transact-SQL)
- sp_help_agent_profile (Transact-SQL)