sp_addserver System Stored Procedure

Defines a remote server or the name of the local server.

Syntax

sp_addserver server_name [, LOCAL]

where

server_name
Is the name of the new server, which is added to the master.dbo.sysservers table. Server names must be unique and must conform to the rules for identifiers.
LOCAL
Is an optional parameter that identifies the server being added as the local server. This parameter sets the value of the global variable @@SERVERNAME. (The setup program sets this variable to the computer name during installation. It is recommended that you do not change the name to something other than the computer name because the computer name is how users connect to SQL Server by default without the need for additional configuration). The local definition takes effect only after the server is shut down and restarted.

Remarks

To execute a stored procedure on a remote server, the remote server must be added to the sysservers table.

To set or clean server options, use the sp_serveroption system stored procedure .

Example

This example creates an entry for a remote server named ACCOUNTS in the local master.dbo.sysservers table.

sp_addserver ACCOUNTS

Permission

Execute permission defaults to the system administrator and the database owner.

Table Used

master.dbo.sysservers

See Also

sp_addremotelogin sp_helpremotelogin
sp_dropremotelogin sp_helpserver
sp_dropserver sp_serveroption