sp_client_addr

Description

Displays the IP (Internet Protocol) address of every Adaptive Server task with an attached client application, including the spid and the client host name.

Syntax

sp_client addr [spid]

Parameters

spid

specifies one task for which you require an IP address.

Examples

Example 1

Lists IP addresses for all tasks:

sp_client_addr
---------
spid   hostname  ipaddr
-----------------------------
11     FRED      162.66.131.36
21     BARNEY    162.66.100.233
22     WILMA     162.66.100.206
23     BETTY     162.66.100.119
24     PEBBLES   162.66.100.125
25     BAMBAM    162.66.100.124
(6 rows affected)
(return status = 0)

Example 2

Shows IP addresses for spid 21:

sp_client_addr 21
----------
spid   hostname  ipaddr
-----------------------------
21     BARNEY    162.66.100.233
(1 row affected)
(return status = 0)

Example 3

Shows the result when a client application is not connected via IP:

sp_client_addr 11
----------
spid   hostname  ipaddr
-----------------------------
11     FRED      0.0.0.0
(1 row affected)
(return status = 0)

Example 4

Shows the result of a task with no attached client; for example, Housekeeper:

sp_client_addr 9
----------
spid   hostname  ipaddr
-------------------------------
9                NULL
(1 row affected)
(return status = 0)

Example 5

Shows the result when an incorrect spid is specified:

sp_client_addr 99
----------
Msg 18934, Level 16, State 1:
Procedure "sp_client_addr", Line 32:
spid not found
(return status = 1)

Usage

Permissions

Any user can execute sp_client_addr. Permission checks do not differ based on the granular permissions settings.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

Event

Audit option

Command or access audited

Information in extrainfo

38

exec_procedure

Execution of a procedure

  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

See also

System procedures sp_who