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 https://forum.red-gate.com/categories/sql-prompt

How can we improve SQL Prompt?

(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. Missing withespace after AS in CAST and TRY_CAST function with more complex inner function

    I have experienced that CAST and TRY_CAST do not create the space before the AS with a more complex internal function.

    For example

    TRY_CAST(RIGHT(F22, LEN(F22) - CHARINDEX(':', F22) - 1) AS VARCHAR) is formatted as TRY_CAST(RIGHT(F22, LEN(F22) - CHARINDEX(':', F22) - 1)AS VARCHAR). The same applies to CAST

    TRY_CAST(LEN(F22) AS VARCHAR) works smoothly.

    I made these observations in the online version and of course I don't know if this also applies to the local version.

    Translated with www.DeepL.com/Translator

    2 votes
    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)

      We’ll send you updates on this idea

      0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
    • Lists: In the new Style editor the Variable Declaration, and SELECT Column lists are treated the same. That has killed us.

      Lists: Separate the Variable Declaration from SELECT Columns so they do not have to be treated the same. We need variable declaration to be on separate lines, but SELECT Column list to NOT be on separate lines. Version 7.5 is the last version we can use because of this change that was made on styles.

      1 vote
      Sign in
      Check!
      (thinking…)
      Reset
      or sign in with
      • facebook
      • google
        Password icon
        Signed in as (Sign out)

        We’ll send you updates on this idea

        0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
      • remove semicolons

        The SQL Prompt menu has an item/hotkey for Insert Semicolons, but no matching item/hotkey to remove them. Suggest these be added

        3 votes
        Sign in
        Check!
        (thinking…)
        Reset
        or sign in with
        • facebook
        • google
          Password icon
          Signed in as (Sign out)

          We’ll send you updates on this idea

          0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
        • style editor semicolon

          The style editor has no "End statements with semicolon" checkbox. It's conceivable that one team may want ANSI-looking SQL and another one not.

          2 votes
          Sign in
          Check!
          (thinking…)
          Reset
          or sign in with
          • facebook
          • google
            Password icon
            Signed in as (Sign out)

            We’ll send you updates on this idea

            0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
          • Format SQL : Add blank line at end of script

            Can you add an option to add a blank line at the end of a script, when formatting? This would help when concatenating scripts together.

            2 votes
            Sign in
            Check!
            (thinking…)
            Reset
            or sign in with
            • facebook
            • google
              Password icon
              Signed in as (Sign out)

              We’ll send you updates on this idea

              0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
            • Need a hotkey for toggling between "one on a line" to "all on one line" for any selected comma delimited list.

              A hotkey for toggling between "one on a line" to "all on one line" for any selected comma delimited list.

              Allowing us to assign hotkeys for styles would accomplish this, most of the time but for speed I don't want to have to mouse around, I want to make the selection with my mouse and issue by pressing a hotkey.

              I often need to change between this format for development:
              INSERT INTO zts_dev_coco_20180410.dbo.Zo_MiniOz12
              ( GridCode
              , RowOrd
              , RowCodeBase
              , Partition
              , RowText
              )
              SELECT
              GridCode
              , RowOrd
              , RowCodeBase = 'newbase'
              , Partition
              , RowText = 'New gazelle'
              FROM…

              1 vote
              Sign in
              Check!
              (thinking…)
              Reset
              or sign in with
              • facebook
              • google
                Password icon
                Signed in as (Sign out)

                We’ll send you updates on this idea

                1 comment  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
              • Put single quote marks around highlighted text (including multiple lines)

                Very often i have copied a list of items i want to query in an IN() statement from the database, for example:

                abc
                def
                ghi
                jkl

                and I want to format it like this:

                'abc'
                'def'
                'ghi'
                'jkl'

                or better yet:

                'abc'
                , 'def'
                , 'ghi'
                , 'jkl'

                Being able to highlight, right click, and select an option do do this, would be incredibly helpful.

                2 votes
                Sign in
                Check!
                (thinking…)
                Reset
                or sign in with
                • facebook
                • google
                  Password icon
                  Signed in as (Sign out)

                  We’ll send you updates on this idea

                  3 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                • Change curly quotes to straight quotes

                  When pasting SQL from emails, web sites, etc. there are often curly quotes. It would be nice to have those replaced with straight quotes instead of manually replacing each one.

                  See:
                  https://practicaltypography.com/straight-and-curly-quotes.html

                  0 votes
                  Sign in
                  Check!
                  (thinking…)
                  Reset
                  or sign in with
                  • facebook
                  • google
                    Password icon
                    Signed in as (Sign out)

                    We’ll send you updates on this idea

                    0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                  • Conditionally place ON keyword on new line if exceeds specified wrap margin

                    My default preference is to maintain the ON keyword without a new line. I would like to be able to CONDITIONALLY place the ON keyword on a new line if, and only if the ON keyword together with the associated ON condition exceed a configurable wrap threshold.

                    Example:
                    -- Yield this >>>>
                    SELECT *
                    FROM Person.Address
                    INNER JOIN Person.StateProvince
                    ON StateProvince.StateProvinceID=Address.StateProvinceID
                    -- >>>> instead of

                    SELECT *
                    FROM Person.Address
                    INNER JOIN Person.StateProvince ON StateProvince.StateProvinceID=Address.StateProvinceID
                    -- Assuming the JOIN clause exceeds the wrap length
                    -- <<<

                    This is particularly useful if the "Place JOIN table on new line" is NOT selected…

                    1 vote
                    Sign in
                    Check!
                    (thinking…)
                    Reset
                    or sign in with
                    • facebook
                    • google
                      Password icon
                      Signed in as (Sign out)

                      We’ll send you updates on this idea

                      0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                    • "only if table expression" option for Place JOIN table on new line

                      My preference is to not select "Place JOIN table on new line" option. However, if the JOIN target is an SELECT expression, it quickly becomes difficult to follow. The JOIN with SELECT expression is much better suited to have the "Place JOIN table on a new line"

                      The idea is to have a "Only if JOIN Expression" sub-option for "Place JOIN on new line" to allow best of both worlds.

                      Example:

                      --- >>>> BEGIN EXAMPLE
                      SELECT TOP (10) *
                      FROM dbo.Player AS p
                      INNER JOIN
                      (
                      SELECT c.CountryCode, c.Name, c.A2, c.A3
                      FROM dbo.Country AS c
                      WHERE c.IsValid<>0
                      ) AS c…

                      1 vote
                      Sign in
                      Check!
                      (thinking…)
                      Reset
                      or sign in with
                      • facebook
                      • google
                        Password icon
                        Signed in as (Sign out)

                        We’ll send you updates on this idea

                        1 comment  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                      • Remove redundant parentheses

                        I sometimes get code that looks like this:
                        WHERE (a = b) AND (c = d) AND (e = f)

                        Or even like this:
                        WHERE (((a = b) AND (c = d)) AND (e = f))

                        It would be great if SQL Prompt would have an option to remove all the redundant parentheses and reduce this to
                        WHERE a = b AND c = d AND e = f

                        Of course it would have to be smart enough to not remove parentheses that are needed when mixing AND and OR. So if I submit this code:
                        WHERE ((a = b)…

                        3 votes
                        Sign in
                        Check!
                        (thinking…)
                        Reset
                        or sign in with
                        • facebook
                        • google
                          Password icon
                          Signed in as (Sign out)

                          We’ll send you updates on this idea

                          2 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                        • Formatting Style Suggestion

                          Some suggestions for formatting options; the options needed to create this format are all there in some form but are not combined or available in a way that make it possible today.

                          • Align "when" and "condition" to tab for case statements
                          • New line for "then" when "condition" is longer than some limit for case statements
                          • New line after last statement in select list
                          • New line after "left" and “outer” in join clause
                          • New line after “cross” in cross apply and cross join
                          • Align "and" to statement in join clause BUT align “and” to first…

                          3 votes
                          Sign in
                          Check!
                          (thinking…)
                          Reset
                          or sign in with
                          • facebook
                          • google
                            Password icon
                            Signed in as (Sign out)

                            We’ll send you updates on this idea

                            0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                          • Convert two-option case statements to IIF()

                            One of my SQL Prompt styles optimizes for shortness. Often (especially in older modules) there's two-option (or one-option) case statements that I prune down to IIF(). It'd be nice to do this automagically for

                            CASE WHEN [Foo]=[Bar] THEN 1 ELSE 0 END
                            ...to...
                            IIF([Foo]=[Bar],1,0)

                            ...or...
                            CASE [Baz] WHEN [Blah] THEN [Bing] END
                            ...to...
                            IIF([Baz]=[Blah],[Bing],NULL)

                            1 vote
                            Sign in
                            Check!
                            (thinking…)
                            Reset
                            or sign in with
                            • facebook
                            • google
                              Password icon
                              Signed in as (Sign out)

                              We’ll send you updates on this idea

                              1 comment  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                            • Do NOT indent the outermost BEGIN-END in a Procedure - FIX NEEDED

                              Despite https://redgate.uservoice.com/forums/94413-sql-prompt/suggestions/8979655-don-t-indent-begin-end-bloc-after-as-in-function-p stating it is "Completed" it IS NOT!

                              This should be at the very least an Option, simply because we lose an entire tab-width of real-estate from every formatted procedure, and that's entirely unnecessary, and didn't used to be the case.

                              This, therefore, IS a bug, but Red Gate Support suggested I add it as a Uservoice... Inappropriate in my mind, but here it is...

                              CREATE PROC dbo.Frustrated @Again int = 1
                              AS
                              BEGIN
                              ^^^^IF BLOCK
                              ^^^^^^^^BEGIN
                              ^^^^^^^^^^^^SET something
                              ^^^^^^^^END
                              END

                              This was depicted in the cited Uservoice above. It is NO LONGER FUNCTIONING.

                              Please FIX.

                              1 vote
                              Sign in
                              Check!
                              (thinking…)
                              Reset
                              or sign in with
                              • facebook
                              • google
                                Password icon
                                Signed in as (Sign out)

                                We’ll send you updates on this idea

                                0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                              • Ending Subquery parenthesis aligned to opening parenthesis - option please

                                Similar to the CTE request https://redgate.uservoice.com/forums/94413-sql-prompt/suggestions/19545028-format-cte-closing-parenthesis

                                Aligning the closing parenthesis on its own line, in the same column as the opening paren, makes the subquery stand out, as well as making the alias stand out.

                                1 vote
                                Sign in
                                Check!
                                (thinking…)
                                Reset
                                or sign in with
                                • facebook
                                • google
                                  Password icon
                                  Signed in as (Sign out)

                                  We’ll send you updates on this idea

                                  0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                • Move "Apply column alias style" from Global to Custom Style

                                  Competing preferences for alias formatting cannot be accommodated because that setting is at a GLOBAL Level.

                                  IMO, ALL "Actions" on the standard "Styles" page of the SQP Options dialog must migrate to the custom configuration settings. (ONLY because some folks are so intransigently bound to their style, and because it's not worth Team angst to go to war.)

                                  1 vote
                                  Sign in
                                  Check!
                                  (thinking…)
                                  Reset
                                  or sign in with
                                  • facebook
                                  • google
                                    Password icon
                                    Signed in as (Sign out)

                                    We’ll send you updates on this idea

                                    0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Indent statement after IF when not enclosed by BEGIN/END block

                                    if blah=1
                                    ____return 1;

                                    if blah=2
                                    ____begin
                                    ____return 2;
                                    ____end
                                    else
                                    ____return 0;

                                    3 votes
                                    Sign in
                                    Check!
                                    (thinking…)
                                    Reset
                                    or sign in with
                                    • facebook
                                    • google
                                      Password icon
                                      Signed in as (Sign out)

                                      We’ll send you updates on this idea

                                      1 comment  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                    • constraint names

                                      Help to auto name constraints, based on a standard that you configure. So if you have
                                      CREATE TABLE test (testId int primary key)

                                      Format could change it to CONSTRAINT PKtest PRIMARY KEY

                                      You could provide a template for the different keys, and perhaps some form of sequential numbering for contraints where there can be > 1

                                      3 votes
                                      Sign in
                                      Check!
                                      (thinking…)
                                      Reset
                                      or sign in with
                                      • facebook
                                      • google
                                        Password icon
                                        Signed in as (Sign out)

                                        We’ll send you updates on this idea

                                        0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                      • Option to format expressions when they exceed a certain number of operators

                                        When an expression becomes complicated, exceeds, for example, three operators, then format it. Otherwise allow it to remain in one line.

                                        4 votes
                                        Sign in
                                        Check!
                                        (thinking…)
                                        Reset
                                        or sign in with
                                        • facebook
                                        • google
                                          Password icon
                                          Signed in as (Sign out)

                                          We’ll send you updates on this idea

                                          1 comment  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                        • Arithmetic expressions - format consistently with logical expressions

                                          Arithmetical expressions and compound logical expressions all consist of operations and expressions with parentheses and orders of precedence. All of these should have the options for aligning operands, aligning parentheses, adding parentheses to make the default orders of precedence explicit. All expressions are subordinate to clauses so they should be indented under WHERE, ON, SELECT, WHEN.

                                          1 vote
                                          Sign in
                                          Check!
                                          (thinking…)
                                          Reset
                                          or sign in with
                                          • facebook
                                          • google
                                            Password icon
                                            Signed in as (Sign out)

                                            We’ll send you updates on this idea

                                            0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                          ← Previous 1 3 4 5 9 10
                                          • Don't see your idea?

                                          Feedback and Knowledge Base