SQL Flow Field Guide

QUOTENAME

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

string transform

What changes

Input
string arguments
Output or change
string or integer
Return type
nvarchar(258)

Syntax at a glance

QUOTENAME ( 'character_string' [ , 'quote_character' ] )

Work example

Quote a database identifier when building carefully controlled dynamic SQL.

Keep values parameterized with sp_executesql and use QUOTENAME only for validated identifiers.

Check your work QUOTENAME protects identifier delimiters but does not make arbitrary SQL text safe.

Practice SQL

Open in SQL Flow
SELECT QUOTENAME('Order Detail') AS quoted_identifier;

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