SQL Flow Field Guide

@@SERVICENAME

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

reads configuration (@@ function)

What changes

Input
server or session configuration state
Output or change
value
Return type
nvarchar

Syntax at a glance

@@SERVICENAME

Work example

Distinguish the SQL Server service instance name during configuration review.

Read in the same session and compare before and after a controlled session setting change.

Check your work Service name is instance metadata and not a login or database authorization value.

Open Microsoft Learn for full syntax, permissions, and details for your version.