Dofactory.com
Dofactory.com
Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

SQL QUOTENAME Function

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.

Example

#

Add square bracket delimiters to the given string.

SELECT QUOTENAME('Order') AS 'Table Name'
Result:  1 record
Table Name
[Order]

Syntax

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 [].


More Examples

QUOTENAME with quote characters

Displays a string with different delimiters.
SELECT QUOTENAME('Order', '()') AS 'Parentheses',
       QUOTENAME('Order', '"') AS 'Double Quotes',
       QUOTENAME('Order', '{}') AS 'Curly Braces'
Result:  1 record
Parentheses Double Quotes Curly Braces
(Order) "Order" {Order}

You may also like



Last updated on Dec 21, 2023

Earn income with your data and sql skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.