sp_add_agent_parameter

Transact-SQL Reference

Transact-SQL Reference

sp_add_agent_parameter

Adds a new parameter and its value to an agent profile. This stored procedure is executed at the Distributor where the agent is running, on any database.

Syntax

sp_add_agent_parameter [ @profile_id = ] profile_id
    , [ @parameter_name = ] 'parameter_name'
    , [ @parameter_value = ] 'parameter_value'

Arguments

[@profile_id = ] profile_id

Is the ID of the configuration from the MSagent_profiles table in the msdb database. profile_id is int, with no default.

[@parameter_name = ] 'parameter_name'

Is the name of the parameter. parameter_name is sysname, with no default. For system profiles, the parameters that can be changed depend on the type of agent. To find out what agent type this profile_id represents, find the profile_id in the Msagent_profiles table, and note the agent_type field value. For a Snapshot Agent, which has a value of 1 in the agent_type field, the following properties can be changed:

  • bcpbatchsize

  • historyverboselevel

  • logintimeout

  • maxbcpthreads

  • querytimeout

    For a Log Reader Agent, which has a value of 2 in the agent_type field, the following properties can be changed:

  • historyverboselevel

  • logintimeout

  • pollinginterval

  • querytimeout

  • readbatchsize

  • readbatchthreshold

    For a Distribution Agent, which has a value of 3 in the agent_type field, the following properties can be changed:

  • bcpbatchsize

  • commitbatchsize

  • commitbatchthreshold

  • historyverboselevel

  • logintimeout

  • maxbcpthreads

  • maxdeliveredtransactions

  • pollinginterval

  • querytimeout

  • transactionsperhistory

  • skiperrors

    For a Merge Agent, which has a value of 4 in the agent_type field, the following properties can be changed:

  • pollinginterval

  • validateinterval

  • logintimeout

  • querytimeout

  • maxuploadchanges

  • maxdownloadchanges

  • uploadgenerationsperbatch

  • downloadgenerationsperbatch

  • uploadreadchangesperbatch

  • downloadreadchangesperbatch

  • uploadwritechangesperbatch

  • downloadwritechangesperbatch

  • validate

  • fastrowcount

  • historyverboselevel

  • changesperhistory

  • bcpbatchsize

  • numdeadlockretries

    For custom profiles, the parameters that can be changed depend on the parameters defined. To see what parameters have been defined, run sp_help_agent_profile to see the profile_name associated with the profile_id. With the appropriate profile_id, next run sp_help_agent_parameters using that profile_id to see the parameters associated with the profile.

[@parameter_value = ] 'parameter_value'

Is the value to be assigned to the parameter. parameter_value is nvarchar(255), with no default.

Return Code Values

0 (success) or 1 (failure)

Remarks

sp_add_agent_parameter is used in snapshot replication, transactional replication, and merge replication.

Permissions

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

See Also

Distribution Agent Profile

Log Reader Agent Profile

Merge Agent Profile

Snapshot Agent Profile

sp_add_agent_profile

sp_change_agent_profile

sp_drop_agent_parameter

sp_help_agent_parameter

System Stored Procedures