SQL Flow Field Guide

HOST_NAME

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

system function

What changes

Input
arguments or engine/session state
Output or change
value
Return type
nvarchar(128)

Syntax at a glance

HOST_NAME ()

Work example

Read the client host name reported for the session.

Read state in the intended scope and immediately after the statement it describes. Treat host values as untrusted.

Check your work A client can supply this value, so it is not a trusted device identity.

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