New training course: Customizing SQL Prompt. Watch now.

Single-quote handling changed??

Hi!

I noticed an oddity with SQLPrompt that I am pretty sure was not there before. This might be related to my upgrade to SSMS 17.3, as that is the only thing I recently changed.

Based on my preference settings, when I type
SELECT (1);
, SQLPrompt will provide a closing parenthesis as I type the open parenthesis; if I then still type it myself if will recognise I typed the character I provided and simply skip past it. The result is the code I intended.

However, when I type
SELECT 'a';
, I *used* to get the same behaviour for the single-quote marks. As I type the first, SQL Prompt automatically provides a closing quotemark; as I then type another single-quote mark it USED TO skip past it and leave me with the intended SQL.

But not anymore. Now, what I see is that I still get a second quotemark as I type the first, but when I type the second it will simply be inserted. So now, when I type
SELECT 'a';
with SQLPrompt enabled, the result looks like
SELECT 'a';'
and it will throw an error when I execute it.

I have now changed the options to no longer automatically add the closing single-quote-mark, so I will no longer be burned by this, but it would be nice to be able to turn that option back on after this bug is fixed.
--
Hugo Kornelis
(SQL Server MVP, 2006-2016 // Friend of Red Gate)

Best Answer

  • krzysztofkroczakkrzysztofkroczak Posts: 55 Silver 2
    Accepted Answer
    Hi @HugoKornelis,

    Sorry for your inconvenience.
    I tried to reproduce it, but I couldn't. I tried to do it on SSMS2016 and SSMS17.3.
    Could you provide more info about SSMS environment? Is it still a problem? Is it a just first run problem?
    Have you seen anything specific in logs?
    Do you have any other extensions which could break normal behaviour?

    Best regards,
    Krzysztof

Answers

  • Hi Krzysztof,

    After reading your message I tried if I can still reproduce it. I re-enabled the option to add a closing single-quote mark and tried what happens. And it does work as intended (and as it did previously) for me.

    So I don't know if this wa a one-time thing, or if it is a sporadic on-and-off thing. I'll leave the option on and I'll let you know if it returns.

    I don't know which logs I should check for this or where to find them. The only other SSMS extension I have is the SQL Sentry Plan Explorer plug-in, and I've been using that "forever".

    Thanks for your reply. For now, you can probably consider this as fixed.

    Cheers,
    Hugo
    --
    Hugo Kornelis
    (SQL Server MVP, 2006-2016 // Friend of Red Gate)
Sign In or Register to comment.