Single Quote Behaviour | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Single Quote Behaviour


select ”,””,”””,”””” returns
””” I dont understand how the single quotes function here
Madhivanan Failing to plan is Planning to fail
For each single ‘ you need to double it in order to get a valid string. You start counting at 0, so:
SELECT ” -> 0
SELECT ”” -> 1
SELECT ””” -> 2
SELECT ”””” -> 3

ad infinitum… —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)

Yes First and last quotes specify that it is a string and within that every two single quotes is equivalent to single single quote
Madhivanan Failing to plan is Planning to fail
Btw, to escape this maze of ”s, do you know about the QUOTENAME() function? —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)

Even Quotename function is a tricky one,
But never come across using such function in general
Yes I know that but never used
Can you explain with example?
Madhivanan Failing to plan is Planning to fail
http://www.sommarskog.se/dynamic_sql.html Erland has there used QUOTENAME() and his own QUOTESTRING() function. —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)

Thats really nice
Madhivanan Failing to plan is Planning to fail
]]>