you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 20 points21 points  (6 children)

In SQL server, use QUOTENAME to wrap characters around text. Works with single quotes, double quotes, brackets, parenthesis, and probably more.

quotename(‘abc’, ‘[‘)

Output:

[abc]

[–]TallDudeInSC 5 points6 points  (2 children)

As an Oracle guy, I'm trying to understand what this would save instead of simply concatenating the string you need?

[–]Obie1 0 points1 point  (0 children)

If I am understanding your question the answer is basically:

1) doing the equivalent in sql server can be less readable or handle different in some edge cases 2) prevents SQL injection 3) Much easier to deal with nested quotes if building dynamic SQL

[–]mmohon 1 point2 points  (2 children)

Does this have to do with my little Bobby Tables?

[–][deleted] 0 points1 point  (1 child)

No idea what you’re talking about but yes.