Cluster environments only – returns the id of the effective local system temporary database of the specified instance. Returns the id of the effective local system temporary database of the current instance when instance_id is not specified.
sys_tempdbid(instance_id)
ID of the instance.
Returns the effective local system temporary database id for the instance with an instance id of 3:
select sys_tempdbid(3)
If you do not specify an instance ID, sys_tempdbid returns the id of the effective local system temporary database for the current instance.
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can run sys_tempdbid.