instance_id

Description

Cluster environments only – Returns the id of the named instance, or the instance from which it is issued if you do not provide a value for name.

Syntax

instance_id([name])

Parameters

name

name of the instance whose ID you are researching.

Examples

Example 1

Returns the ID of the local instance:

select instance_id()

Usage

Returns the ID of the instance named “myserver1”:

select instance_id(myserver1)

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute instance_id.