Change quote completion behavior within Openquery or dynamic SQL strings
I really like auto quote completion, but when I am working with an openquery statement or dynamic sql where I am having to escape quotes by doubling them up, I find myself fighting the "helpful" behavior of quote completion either refusing to add a second quote or it adds too many quotes.
So, my suggestion is that the quote completion feature check to see if you are trying to add quotes within a quoted string and change its behavior to either not do quote completion or to (even better) automatically add escaped quotes.
To illustrate the problem and my proposed solution:
I am starting a statement like this:
FROM OPENQUERY(unica, '
Select HOUSEKEY, ESTIMATEDHOUSEHOLDINCOME, SITEID
from cm.householddemographics hd
where SITEID in(
At this point I need to enter a list of values separated by quotes and commas. Because this inside a string, I need to enter a pair of single quotes for at the start and end of every value, but when I type the second single quote, it gives me two, so now I have three single quotes when I was trying to get two.
Ideally, SQL Prompt would see that I was inside string at this point and either turn off the completion so that when I type two single quotes , I get only two single quoutes, or even better it would always give me a pair of single quotes when I type one (though this could be a problem too, if not handled well).
Hope that explanation makes sense.