QUOTENAME
adds delimiters to a string making it a valid SQL Server identifier.
The delimiter can be quotation mark, bracket, parentheses, and others.
Delimiters are added before and after the input string.
Add square bracket delimiters to the given string.
SELECT QUOTENAME('Order') AS 'Table Name'
Table Name |
---|
[Order] |
Syntax of the QUOTENAME function.
QUOTENAME(string [,quote-character])
string
-- a string with up to 128 characters.
quote-character
-- optional. Characters to use as delimiters. Default is [].
SELECT QUOTENAME('Order', '()') AS 'Parentheses',
QUOTENAME('Order', '"') AS 'Double Quotes',
QUOTENAME('Order', '{}') AS 'Curly Braces'
Parentheses | Double Quotes | Curly Braces |
---|---|---|
(Order) | "Order" | {Order} |