sp_addserver

Description

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

Syntax

sp_addserver lname [, class [, pname]]

Parameters

lname

is the name used to address the server on your system. sp_addserver adds a row to the sysservers table if there is no entry already present for lname. Server names must be unique and must conform to the rules for identifiers.

class

identifies the category of server being added. Table 8-4 lists allowable values for the class parameter:

Table 8-4: Allowable values for server_class parameter

class parameter value

Description

access_server

Component Integration Services only – Server coded to the DirectConnect™ specification

db2

Component Integration Services only – Server accessible by Net-Gateway™ or MDI™ Database Gateway

direct_connect

Component Integration Services only – functionally the same as access_server

local

Local server (there can be only one) used only once after start-up, or after restarting Adaptive Server, to identify the local server name so that it can appear in messages printed by Adaptive Server

null

Remote server with no category defined

sql_server

Another Adaptive Server or Omni server (this is the default value)

pname

is the name in the interfaces file for the server named lname. This enables you to establish local aliases for other Adaptive Servers or Backup Servers that you may need to communicate with. If you do not specify a pname, lname is used.

Examples

Example 1

Adds an entry for a remote server named GATEWAY in master.dbo.sysservers. The pname is also GATEWAY:

sp_addserver GATEWAY

Example 2

Adds an entry for a remote server named GATEWAY in master.dbo.sysservers. The pname is VIOLET. If there is already a sysservers entry for GATEWAY with a different pname, the pname of server GATEWAY changes to VIOLET:

sp_addserver GATEWAY, null, VIOLET

Example 3

Adds an entry for the local server named PRODUCTION:

sp_addserver PRODUCTION, local

Example 4

Adds an entry for a remote server known to the local server as SQLSRV10. The remote server is of server class sql_server. The network_name for SQLSRV10 is SS_MOSS:

sp_addserver SQLSRV10, sql_server, SS_MOSS

Usage

Permissions

Only a System Security Officer can execute sp_addserver.

See also

System procedures sp_addremotelogin, sp_dropremotelogin, sp_dropserver, sp_helpremotelogin, sp_helpserver, sp_serveroption