How can we improve SQL Prompt?

Automatic semicolons

Include an option when reformatting SQL to automatically add semicolons at the end of each statement if they are missing.
While in most cases SQL Server 2005 and 2008 don't require this, the 2008 docs mention that a future version might.
and it may also be helpful if trying to move code from SQL Server 200x to a dialect which does require them.

170 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Ned BushNed Bush shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    LubomirLubomir shared a merged idea: Add a semmicolon after T-SQL command  ·   · 
    Alessandro AlpiAlessandro Alpi shared a merged idea: "add semi-colon after all the statements" flag  ·   · 

    9 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • GaryGary commented  ·   ·  Flag as inappropriate

        Is there an option to disable Automatic semicolons. I can't see it. For now I have uninstalled the new version and reverted to 6.1. It is driving me up the wall.

        We have 30 licenses at the moment, and most of my guys are of the same opinion.

        When you are in the middle of writing a complex query, formatting is useful, we do it several times as we keep adding to it. However you tend to keep tacking bits on the end and the semicolons get in the way.

        When it is finished it would be good to have another option to add semicolons.

        Eg Ctrl+K+Y work the same, then Ctrl+K+C could add the semicolons. But for now I’d prefer to ability to remove semicolons and add them in manually.

        Many thanks
        Gary

      • Klaus OndrichKlaus Ondrich commented  ·   ·  Flag as inappropriate

        Yes, I know those snippets. We are using this awesome feature for code standardization (whole TRY/CATCH blocks with transactions and error handling within a snippet, for example), too.

      • Aaron LawAdminAaron Law (Software Engineer, Red Gate) commented  ·   ·  Flag as inappropriate

        Hi Klaus,
        I guess the problem with always putting semicolons after snippets is snippets aren't required to contain complete/valid sql statements, so Prompt might get this wrong. Eg imagine if someone had the snippet to insert a comment header, or create a couple of columns in a create table statement - in these cases Prompt could be more annoying than helpful.

      • Klaus OndrichKlaus Ondrich commented  ·   ·  Flag as inappropriate

        Aaron, thanks for this feature. I think, it could be improved by automatically adding semicolons for each statement generated by snippets. So, ssf should expand to SELECT * FROM |; (where the pipe should indicate the position of the cursor) without the neet to add the semicolon to each snippet.

      • Aaron LawAdminAaron Law (Software Engineer, Red Gate) commented  ·   ·  Flag as inappropriate

        Hi Kevin,
        Thanks for the link!

        I can confirm that this feature will be included in 6.4 - Hopefully we’ll have a beta build for it out in a few weeks.
        Prompt won’t change the behaviour of the existing script so it won’t fix (or break) some of the sneaky cases mentioned in the blog post such as having an alias named “throw”. But hopefully the inserted semicolons will help make cases like that slightly easier to spot.

      Feedback and Knowledge Base