SQL Prompt

Welcome to the SQL Prompt feature suggestion list. Find out more information about SQL Prompt at http://www.red-gate.com/products/sql-development/sql-prompt/.

If you have any questions, need help or have found a bug in SQL Prompt, please visit the forums at http://www.red-gate.com/messageboard/viewforum.php?f=169.

How can we improve SQL Prompt?

You've used all your votes and won't be able to post a new idea, but you can still search and comment on existing ideas.

There are two ways to get more votes:

  • When an admin closes an idea you've voted on, you'll get your votes back from that idea.
  • You can remove your votes from an open idea you support.
  • To see ideas you have already voted on, select the "My feedback" filter and select "My open ideas".
(thinking…)

Enter your idea and we'll search to see if someone has already suggested it.

If a similar idea already exists, you can support and comment on it.

If it doesn't exist, you can post your idea so others can support it.

Enter your idea and we'll search to see if someone has already suggested it.

  • Hot ideas
  • Top ideas
  • New ideas
  • My feedback
  1. 206 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…)
      24 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
    • Refactoring INSERT into UPDATE

      I wish there where a shortcut/command to change a statement like

      INSERT INTO Mytable(Id,Code,Label) VALUES (@Id,@Code,@Label)

      in

      UPDATE MyTable
      SET Id=@Id, Code=@Code, Label =@Label

      Even if it looks trivial on this statement, doing it with a table with 10+ Columns might be cumbersome.

      169 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…)
        8 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
      • Implement Collapsable Regions

        Developing a script of some size becomes very tedious when going back and forth, and the script quickly becomes unwieldy.

        Add collapsable regions driven by specially formatted comment (--#Region [name/description/comment] ... --#EndRegion, or some other suitable notation).

        137 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…)
          5 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
        • Add options for CASE WHEN ELSE END

          I'd like to be able to configure a style for CASE statements using options like the following:

          - New line after THEN
          - New line before ELSE
          - New line after ELSE
          - ELSE match indent of CASE
          - END match indent of CASE

          It would also be nice to have a threshold setting (in number of characters) so the formatting settings are only applied if the length of a CASE statement exceeds the threshold.

          129 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…)
            8 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
          • Disable SQL Prompt on certain blocks of code

            Add a functionality of disabling SQL Prompt auto-formatting feature for blocks of code. Use SQL comments for 100% sql compatibility. Example:

            SELECT 1, 2, 3
            --<SQLPROPMT disable>
            select 4, 5, 6
            --</SQLPROPMT>
            select 7,8,9

            in the code above, the first and third statements would be auto-formatted but not the second one.

            It would be especially useful for very long scripts where a single formatting template is not an option.

            128 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…)
              11 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
            • Indent comments consistent with code

              I'm finding my comments are hanging out all on their own after the rest of my code is formatted. I would request a feature to allow comments to indent to the same level as the code on the line below.

              119 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…)
                4 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
              • Support a common intending option for SELECT

                Sample query (spaces marked with underscores):

                SELECT__staffId, staffName, a
                FROM____personnel

                SELECT and FROM have whitespace after them to align the rest of the statement. This formatting style is tedious to maintain and almost nowhere to be found in real codebases or on the web. Please support the more common code style:

                SELECT_staffId, staffName, a
                FROM_personnel

                Just one space.

                107 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…)
                  3 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                • Format MDX

                  It would be great to format MDX queries

                  100 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…)
                    5 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                  • Highlight --TODO and --HACK comments

                    When a --#TODO: or --#HACK is written on our code, it could be helpful to highlight it in order to give an alert to the reader. In addition it can be very helpful to let the user to configure the pattern (i.e. --#MyTerm).

                    92 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…)
                      1 comment  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                    • Expose all formatting options in the UI

                      There appears to be several items (BEGIN and END tabbing, table declaration placement, number of tabs for the join condition...etc.) that happen automatically when you click Refactor that Format SQL that you can't configure in the UI.

                      92 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…)
                        6 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →

                        The new formatting styles in SQL Prompt 7.4 allow a lot more customization. This includes options for formatting BEGIN/END, table declarations, and JOINs.

                        To use the new formatting styles, go to SQL Prompt > Options > Labs > Experimental Features and select the ‘Use new formatting styles’ checkbox

                        Let us know what you think!

                        You can download the latest version of SQL Prompt from http://www.red-gate.com/products/sql-development/sql-prompt/

                      • Option to add WITH (NOLOCK)

                        I would like SQL Prompt to be able to insert WITH (NOLOCK) when writing SELECT and JOIN statements. When working with production data, the risk of forgetting to write this chunk and locking data rows is very high.

                        80 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…)
                          11 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                        • Format CTE

                          Allow users to specify how CTEs should be formatted. Right now I get:

                          WITH cte
                          AS (
                          SELECT
                          Title
                          ,FirstName
                          ,LastName
                          FROM
                          isales.dbo.salesteam
                          )
                          SELECT
                          Title
                          ,FirstName
                          ,LastName
                          FROM
                          cte

                          What I would like is:

                          WITH cte
                          AS
                          (
                          SELECT
                          Title
                          ,FirstName
                          ,LastName
                          FROM
                          MyTable
                          )
                          SELECT
                          Title
                          ,FirstName
                          ,LastName
                          FROM
                          cte

                          61 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…)
                            1 comment  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →

                            You can now specify how CTEs should be formatted in SQL Prompt 7.4. To use the new formatting styles, go to SQL Prompt > Options > Labs > Experimental Features and select the ‘Use new formatting styles’ checkbox

                          • Allow Format SQL to execute even when there are errors

                            If I'm halfway through writing a query and I want SQL prompt to format it in order to make it easier to finish what I'm doing, SQL prompt currently will fail because the query's not syntactically correct.

                            What I'd like is an option where I can tell SQL prompt I don't care if the queries I'm formatting are incorrect, just do your best with it and ignore any errors.

                            59 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…)
                              under review  ·  3 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                            • SQL PROMPT 5 - Simple, but toggle indenting of else if statements

                              Allow the option to NOT indent else if statements. Each of the ELSE IF statements gets further indented and for large SQL it becomes indented off the screen. I can imagine this pattern could apply else where but for this specific use case our STPs that have this condition i simply can't format the sql because it requires me to horizontally scroll. Allowing me to disable indenting ELSE IF statements would solve this problem instantly.

                              53 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…)
                                2 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                              • Column aliases alignment

                                Allow alignment of column aliases in a Select statement.

                                50 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…)
                                  5 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                • SQL Prompt > Format SQL Update for SQL Server 2016

                                  Any query where "AT TIME ZONE" is used (new feature in SS '16), the Format SQL throws and error.

                                  "SQL Prompt was unable to complete this operation. Problem areas have been highlighted"

                                  The highlighting start from "AT TIME ZONE..."

                                  Thank you

                                  45 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…)
                                    0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Replace all tabs with spaces

                                    Setting the option to use spaces instead of tabs for intending (our house policy) only works for new tab presses.
                                    I would like a simple action that would replace all tabs in the current document with spaces -- using the tab-to-spaces value as set in options. Sublime Text has this and I use practically every time I edit anything.

                                    42 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…)
                                      2 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                    • Change formatting of IF statements.

                                      When an IF is short and does not have a BEGIN END on it, have it format to a single line.

                                      Right now if you have

                                      IF @Parameter1 = 0
                                      RETURN -1
                                      IF @Parameter2 = 0
                                      RETURN -2

                                      I would like it to be:

                                      IF @Parameter1 = 0 RETURN -1
                                      IF @Parameter2 = 0 RETURN -2

                                      which would make it more compact.

                                      41 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…)
                                        planned  ·  1 comment  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                      • Moving commas from "end" to "start" is always buggy when comments exist

                                        Moving *commas* from "end" to "start" or vice-versa is buggy when comments exist after each column or parameter. This is an issue regardless of the type of statement (SELECT, INSERT, UPDATE, CREATE TABLE/VIEW/FUNCTION/STORED PROCEDURE, etc).

                                        Here is my original SP with commas at "end" followed by comments (hyphens are used for indentation due to HTML formating issues):
                                        CREATE PROCEDURE dbo.MyProcedure
                                        ---- @Param1 int, --Param1 comments
                                        ---- @Param2 int, --Param2 comments
                                        ---- @Param3 int --Param3 comments
                                        AS
                                        BEGIN
                                        ---- SELECT Col1 , --Col1 comments
                                        ---- ---- Col2 , --Col2 comments
                                        ---- ---- Col3 --Col3 comments
                                        ---- FROM MyTable
                                        ---- RETURN
                                        END …

                                        35 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…)
                                          2 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                        • Format CTEs to keep the semicolon on the same line as the "With"

                                          When you format:

                                          SELECT x from y

                                          ;WITH NumberSequence ( MonthNumber )
                                          AS ( SELECT 1 AS MonthNumber
                                          UNION ALL
                                          SELECT MonthNumber + 1
                                          FROM NumberSequence
                                          WHERE MonthNumber < 12
                                          )

                                          You move the semicolon to the end of the previous command instead of leaving it with the CTE and remove the blank line:

                                          SELECT x from y;
                                          WITH NumberSequence ( MonthNumber )
                                          AS ( SELECT 1 AS MonthNumber
                                          UNION ALL
                                          SELECT MonthNumber + 1
                                          FROM NumberSequence
                                          WHERE MonthNumber < 12
                                          )

                                          Should leave the blank line and semicolon where they are.

                                          Thanks,

                                          Tom

                                          33 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…)
                                            under review  ·  3 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                          ← Previous 1 3 4 5 6 7 8
                                          • Don't see your idea?

                                          Feedback and Knowledge Base