Returns a Unicode string surrounded by delimiters to make it a valid SQL Server delimited identifier.
Parameters:
sysname
). If an input string is longer than 128 characters function returns null
.'
or ``), a left or right bracket ({
,[
,(
,<
or >
,)
,]
,}
) or a double quotation mark ("
). Any other value will return null. Default value is square brackets.SELECT QUOTENAME('what''s my name?') -- Returns [what's my name?]
SELECT QUOTENAME('what''s my name?', '[') -- Returns [what's my name?]
SELECT QUOTENAME('what''s my name?', ']') -- Returns [what's my name?]
SELECT QUOTENAME('what''s my name?', '''') -- Returns 'what''s my name?'
SELECT QUOTENAME('what''s my name?', '"') -- Returns "what's my name?"
SELECT QUOTENAME('what''s my name?', ')') -- Returns (what's my name?)
SELECT QUOTENAME('what''s my name?', '(') -- Returns (what's my name?)
SELECT QUOTENAME('what''s my name?', '<') -- Returns <what's my name?>
SELECT QUOTENAME('what''s my name?', '>') -- Returns <what's my name?>
SELECT QUOTENAME('what''s my name?', '{') -- Returns {what's my name?}
SELECT QUOTENAME('what''s my name?', '}') -- Returns {what's my name?}
SELECT QUOTENAME('what''s my name?', '`') -- Returns `what's my name?`