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?

(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. 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.

    73 votes
    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)

      We’ll send you updates on this idea

      9 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).

      60 votes
      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)

        We’ll send you updates on this idea

        6 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
      • Format MDX

        It would be great to format MDX queries

        43 votes
        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)

          We’ll send you updates on this idea

          5 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
        • 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.

          42 votes
          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)

            We’ll send you updates on this idea

            11 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).

            42 votes
            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)

              We’ll send you updates on this idea

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

              31 votes
              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)

                We’ll send you updates on this idea

                under review  ·  3 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.

                22 votes
                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)

                  We’ll send you updates on this idea

                  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.

                  20 votes
                  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)

                    We’ll send you updates on this idea

                    planned  ·  1 comment  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                  • Need for automatic "where" concatenation

                    When you are working with SQL it is easy to forget the "where" statement in update, delete. If this happens in production it could be devastating. It would be a nice feature to automatic add the "where" statement in for "delete" and/or "update".

                    19 votes
                    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)

                      We’ll send you updates on this idea

                      5 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

                      17 votes
                      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)

                        We’ll send you updates on this idea

                        under review  ·  3 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                      • Align equals sign in UPDATE

                        Provide an option in Styles to let the right hand side of clauses in UPDATE statement be aligned.

                        Example:

                        UPDATE~~EDSV
                        SET~~~~~eDocSessionID~~~~~~~~~~~~~~~~~~~~~=~CONSV.eDocSessionID~,
                        ~~~~~~~~eDocSessionKey~~~~~~~~~~~~~~~~~~~~=~CONSV.eDocSessionKey~,
                        ~~~~~~~~eDocSessionValue~~~~~~~~~~~~~~~~~~=~CONSV.eDocSessionValue~,
                        ~~~~~~~~eDocSessionValueTextStyleOverride~=~CONSV.eDocSessionValueTextStyleOverride~,
                        ~~~~~~~~eDocSessionValuePositionOverride~~=~CONSV.eDocSessionValuePositionOverride~,
                        ~~~~~~~~eDocSessionValueLockdown~~~~~~~~~~=~''
                        FROM~~~~eDocStd2.dbo.eDocSessionValues~AS~EDSV
                        ~~~~~~~~INNER~JOIN~#changedOrNewSessionValues~AS~CONSV~ON~CONSV.eDocSessionID~=~EDSV.eDocSessionID
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~AND~CONSV.eDocSessionKey~=~EDSV.eDocSessionKey;

                        16 votes
                        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)

                          We’ll send you updates on this idea

                          5 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                        • Unwrap sp_executesql

                          Frequently I need to debug application generated SQL obtained via Profiler. Parameterized queries are often implemented with sp_executesql.

                          I love using Format SQL to make a single line monster query into something I can actually read. But when it's stuck in an sp_executesql call the format function doesn't touch it. I have to:
                          Remove "Exec sp_executesql".
                          Remove the apostrophes around the query SQL. For big queries this is really painful, especially if the query itself contains apostrophes.
                          Remove the apostrophes around the parameter defenitions.
                          Move the parameter definitions to the top and add a DECLARE.
                          Move the parameter value assignments…

                          15 votes
                          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)

                            We’ll send you updates on this idea

                            6 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                          • Improve tab & parenthesis placement of subqueries ...wherever placed in query

                            Would like improve tab & parenthesis placement of subqueries ...wherever placed in query ...be it in JOIN, WHERE, HAVING ...or even in SELECT ...ALSO would like option for 1st tabbed item in SELECT list to be the starting position on each row for each subsequent item which includess the placement of the 'prefixed' comma ...see below...

                            BEFORE (Current formatting)...

                            LEFT OUTER JOIN (
                            SELECT
                            f1
                            , f2
                            , f3
                            FROM
                            dbo.t1
                            WHERE
                            f9 = 'x'
                            ) AS e
                            ON e.f1 = b.f1
                            AND e.f2 = b.f2

                            AFTER...

                            LEFT OUTER JOIN
                            (
                            SELECT
                            f1
                            , f2
                            , f3
                            FROM
                            dbo.t1
                            WHERE …

                            15 votes
                            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)

                              We’ll send you updates on this idea

                              planned  ·  3 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                            • Align aliases, commas, datatypes and expressions at the next tab stop

                              I align aliases, commas, datatypes and expressions at the first tab stop following the longest element in the list. See examples below:

                              -- Tilde character used as space replacement to cope with HTML formatting
                              -- 2-character tabs are assumed below
                              -- In a fixed-space font, the commas, = signs, data types and AS keywords would all line up vertically
                              DECLARE
                              ~~@x~~~~~~~~~~~~~~INT~~~~~~~~~,
                              ~~@var~~~~~~~~~~~~VARCHAR(4)~~,
                              ~~@longer_varname~VARCHAR(10)~,
                              ~~@z~~~~~~~~~~~~~~DATETIME~~~~;

                              SELECT
                              ~~~~@longer_varname~=~'x'~~~~~~~,
                              ~~~~@var~~~~~~~~~~~~=~'1234'~~~~,
                              ~~~~@z~~~~~~~~~~~~~~=~GETDATE()~;

                              SELECT
                              ~~~~T1.short_field~~~~~~~~AS~ShortField~,
                              ~~~~AO.really_long_field~~AS~LongField~~,
                              ~~~~'x'~~~~~~~~~~~~~~~~~~~AS~XChar~~~~~~,
                              ~~FROM~~~~~~~~dbo.table1~~~~~~AS~T1
                              ~~~~LEFT~JOIN~dbo.another_one~AS~AO~ON~T1.keyval~=~AO.keyval;

                              EXEC~@x~=~dbo.SomeProc
                              ~~@Param1~=~'3'~~~~~~~~~~~,
                              ~~@P2~~~~~=~'Longer~Text'~,
                              ~~@P3~~~~~=~4~~~~~~~~~~~~~;

                              14 votes
                              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)

                                We’ll send you updates on this idea

                                2 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                              • Format option for short selects to stay on one line

                                When a SELECT statement is short, for example fits on one line on my screen I would like for the SELECT to not be formatted onto multiple lines. This could even apply to the parts of the SELECT if the entire SELECT statement is long. For example a WHERE statement with only two short clauses could be one line.

                                13 votes
                                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)

                                  We’ll send you updates on this idea

                                  0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                • Command Line "Reformat All Files In Folder" and pre-Commit

                                  Opening over 2500 code objects to set a baseline format, required by a large customer, is a daunting manual task.

                                  Many of Red Gate's tools provide command-line functionality.

                                  Please add it to Prompt so we can bulk (re)format SPs, UDFs, Triggers. Integration into the commit-path (we use SVN) would be ideal for standardized check-ins (Commits).

                                  Can't recall whether a style is exportable... (License key awaited at new employer) Should be able to point to UNC location for the style to use.

                                  13 votes
                                  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)

                                    We’ll send you updates on this idea

                                    5 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Create new Setting to only enclose SQL Keywords in square brackets

                                    I don't want to use brackets for my code (unless I have to). So, for example, dbo.Orders is fine, but dbo.Order isn't. It would be nice if SQL prompt caught this and automatically enclosed the SQL Keyword "Order" in square brackets (i.e. dbo.[Order] AS o)

                                    13 votes
                                    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)

                                      We’ll send you updates on this idea

                                      0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                    • Expand a view or views referenced in a query

                                      I think it would be great if SQL Prompt had the functionality to expand a view that is used in a query. So if you have this schema:
                                      CREATE TABLE dbo.Person
                                      (
                                      PersonID INT IDENTITY(1, 1)
                                      PRIMARY KEY,
                                      LastName VARCHAR(30),
                                      FirstName VARCHAR(30),
                                      );
                                      GO

                                      CREATE TABLE dbo.Student
                                      (
                                      StudentID INT IDENTITY(1, 1)
                                      PRIMARY KEY,
                                      PersonID INT,
                                      StudentNo VARCHAR(100)
                                      );
                                      GO

                                      CREATE TABLE dbo.Class
                                      (
                                      ClassID INT IDENTITY(1, 1)
                                      PRIMARY KEY,
                                      ClassName VARCHAR(100)
                                      );
                                      GO

                                      CREATE TABLE dbo.ClassRoster
                                      (
                                      ClassID INT,
                                      StudentID INT
                                      );

                                      GO

                                      CREATE VIEW dbo.Students
                                      AS
                                      SELECT
                                      S.StudentID,
                                      P.LastName,
                                      P.FirstName,
                                      S.StudentNo
                                      FROM
                                      dbo.Person AS P
                                      JOIN dbo.Student AS…

                                      12 votes
                                      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)

                                        We’ll send you updates on this idea

                                        2 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                      • Format SQL Code on opening file

                                        It would be awsome if there was an option that would format an SQL Script automatically after opening it in SSMS / VS. So if you load a file it would be formatted automatically with your selected formatting style. It would be great too if this auto format option could be switched on and off in the Options.

                                        11 votes
                                        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)

                                          We’ll send you updates on this idea

                                          1 comment  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                        • Comment Word Wrap

                                          Hi!

                                          I would be nice to have the option to enable word wrap for the comments as well.
                                          The number of maximum characters for the comment should be aligned with "Wrap lines longer than" for SQL statements.

                                          10 votes
                                          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)

                                            We’ll send you updates on this idea

                                            0 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