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. Align comment - not for outcommended code

    - I have a SELECT with some comments after the column aliases (e.g. in column 80)
    - I comment a line out
    - I let SQL Prompt format the statement
    -> the outcommented line will be moved to column 80 too, which makes it hard to find / read etc.

    Solution:
    - only align it when there is some regular SQL code before the comment (e.g. a column, table, condition ...)
    - or there are only whitespaces before the comment and it starts (roughly) equal as the comment one line above (multiline comments)
    - and / or do not align…

    1 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)

      We’ll send you updates on this idea

      0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
    • Subquery IN clause indentation doesn't work properly

      I've uploaded a sample query to Pastebin that demonstrates the issue: https://pastebin.com/0nJPWrvx

      My settings file is here: https://pastebin.com/iwb4QMYN

      I'd love it if you could fix two things about this.

      1) The indentation of the "NOT IN" clause on lines 17-18 is atrocious. The issue appears to be that it's aligning to the wrong SELECT statement.

      2) I want to wrap my subqueries with more whitespace. I think adding an option to indent the subquery on dedicated lines would work, and the result would look like they're nested in curly braces like you might see in scripting languages or C#. The…

      1 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)

        We’ll send you updates on this idea

        0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
      • keywords in subqueries to have different casing

        Hi - i've seen that you have a section just for subqueries. could it be possible to have an option to allow subqueries to be formatted with lower case?

        for example i like to have my code look like this

        SELECT TOP 100
        a.AuditLoadID,
        a.LoadDescription,
        a.LoadStatus,
        a.LoadStartDate,
        a.LoadEndDate,
        a.LoadMessage
        FROM
        [admin].AuditLoad AS a
        WHERE
        a.LoadStartDate = (select max(LoadStartDate)
        from [admin].AuditLoad a2
        where AuditLoadID < 100)

        cheers,
        ben

        1 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)

          We’ll send you updates on this idea

          0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
        • SQL Prompt Bug For Extended Events Commands

          When you format SQL containing commands like

          ALTER EVENT SESSION X ON SERVER STATE = START

          or

          ALTER EVENT SESSION X ON SERVER STATE = STOP

          SQL Prompy attempts to put semicolons after SERVER in both commands:

          ALTER EVENT SESSION Locks ON SERVER; STATE = START
          ALTER EVENT SESSION Locks ON SERVER; STATE = STOP

          1 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)

            We’ll send you updates on this idea

            0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
          • more options for column as 'alias'

            Hi RG - using the latest sql prompt. its really good but could I request two enhancements please.

            1. on the casing can we separate the 'as' keyword from the others. i.e. "SELECT", "FROM" etc have one rule applied but "AS" can be set separately (i like to have all my 'as' statements in lower case)

            2. could there be an option to add a column as 'alias' to every column in a SELECT statement (defaulting to the column name). This would do the donkey work and then the sql developer could go and add in friendly names afterwards using…

            1 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)

              We’ll send you updates on this idea

              2 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
            • Format SQL in a folder

              It would be great if there was a feature where we would be possible format an entire folder instead of file by file.

              0 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 →
              • Bulk Format

                In the Object Explorer window when viewing stored procedures/views/functions etc, I think it would be really useful to be able to select multiple objects and have a context menu option that would generate formatted ALTER scripts, thus allowing somebody to update all T-SQL into the desired format.

                Currently, when you have multiple objects selected you are unable to use the "Script xx as - ALTER to" option meaning you would have to either use the CREATE to option and amend to an ALTER, or use the DROP and CREATE to option, which would remove any permissions set against the object.

                2 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 →
                • More options for lists in Format SQL

                  separate options for formatting different types of lists, which are currently all formatted with the same settings:
                  * parameters when defining a function
                  * parameters when calling a function
                  * select
                  * insert column list

                  Option to always put a newline after a multi-line case statement. e.g.
                  select o.name, o.object_id, o.principal_id, o.schema_id, o.parent_object_id, o.type, o.type_desc
                  , friendly_object_type = case o.type
                  when 'S' then 'system table'
                  when 'D' then 'default'
                  when 'V' then 'view'
                  end
                  , o.create_date, o.modify_date, o.is_ms_shipped, o.is_published, o.is_schema_published
                  from sys.objects o
                  order by friendly_object_type

                  instead of

                  select o.name, o.object_id, o.principal_id, o.schema_id, o.parent_object_id, o.type, o.type_desc
                  , friendly_object_type = case…

                  1 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)

                    We’ll send you updates on this idea

                    0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                  • Align parameter assignments in sproc calls

                    There is a lot of excellent alignment logic in the SQL Prompt formatting tool but we notice it is not implemented on parameter assignments in sproc calls. For example, in the statement below we think it would look better and be easier to read if all the equal signs were aligned as is done in DECLARE and other statement types.

                    exec @errorNo = dbo.pPersonMailingAddress#Update
                    @PersonMailingAddressSID = @PersonMailingAddressSID
                    ,@PersonSID = @PersonSID
                    ,@StreetAddress1 = @StreetAddress1
                    ,@StreetAddress2 = @StreetAddress2
                    ,@StreetAddress3 = @StreetAddress3
                    ,@CitySID = @CitySID
                    ,@PostalCode = @PostalCode
                    ,@RegionSID = @RegionSID
                    ,@EffectiveTime = @EffectiveTime;

                    1 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)

                      We’ll send you updates on this idea

                      0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                    • Remove empty lines after single line statements

                      We really like the ability to collapse if statements to a single line when short but we'd prefer the addition of a general option to suppress empty lines between one line statements. For example today we get:

                      -- check parameters
                      if @FormRecordSID is null set @blankParm = '@FormRecordSID';

                      if @FormSchemaName is null set @blankParm = '@FormSchemaName';

                      if @FormTableName is null set @blankParm = '@FormTableName';

                      if @FormDefinition is null set @blankParm = '@FormDefinition';

                      if @Response is null set @blankParm = '@Response';

                      and we would prefer:

                      -- check parameters
                      if @FormRecordSID is null set @blankParm = '@FormRecordSID';
                      if @FormSchemaName is null set…

                      3 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 →
                      • Align inline comments at a consistent guideline column

                        Inline comments are easier to read when they all begin at the same guideline point. Today the formatting of inline comments is ragged. For example:

                        select .... -- my comment here

                        update some stuff ... -- another comment here

                        set @myVar = 5 -- and another one here

                        We would like to see an option that allows you to specify one column (or possibly a max of 3) that the tool uses to align all inline comments starting at the same column. e.g. column 75, 101 and 131 is where we currently have guidelines in our editor. We align the…

                        1 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)

                          We’ll send you updates on this idea

                          0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                        • Empty Line Above and Below Comment Lines

                          We prefer to see comments separated from the code below them by an empty line. Please add an option for that.

                          Example:

                          -- where a previous address exists and is unchanged,
                          -- update the verified time only

                          if @oldCheckSum = @newCheckSum
                          begin
                          exec @errorNo = dbo.pPersonMailingAddress#Update
                          @PersonMailingAddressSID = @PersonMailingAddressSID
                          ,@LastVerifiedTime = @now;
                          end;

                          instead of:

                          -- where a previous address exists and is unchanged,
                          -- update the verified time only
                          if @oldCheckSum = @newCheckSum
                          begin
                          exec @errorNo = dbo.pPersonMailingAddress#Update
                          @PersonMailingAddressSID = @PersonMailingAddressSID
                          ,@LastVerifiedTime = @now;
                          end;

                          2 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 →
                          • Empty Line Before and After Multi-Line Statements

                            Complex multi-line statements are much easier to read when separated by an empty line above and below them. Please add an option to turn on "Empty Line Above/Below Multi-Line Statements".

                            1 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)

                              We’ll send you updates on this idea

                              0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                            • Format CTAS & CRTAS and other APS/PDW commands

                              Please add the "create table xxx with (distribution = ...) as (select ...) as valid so I can use CTRL-K/Y to format code.

                              Also any other APS/PDW key words that don't exist in "regular" SQL Server.

                              Thanks

                              1 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)

                                We’ll send you updates on this idea

                                0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                              • I'd like the ability to have the subsequent conditions of a JOIN right align with the first word of the JOIN clause.

                                For example, when I have an INNER JOIN, I format my SQL so that ON is on the same line as JOIN. If I have a second condition, I put it on a new line. I am currently set up to right align keywords. The AND currently will right align with ON. I'd like the ability to have it right align with the word INNER.

                                1 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)

                                  We’ll send you updates on this idea

                                  0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                • Formatting Schema - CREATE is different from ALTER

                                  In SQL Prompt 8, we can customize the formatting styles. But CREATE and ALTER is defined together in the "Schema (DDL)" Statements section, and goes for all objects.

                                  I would really like more customizability here, as I want different looks when creating or altering different things. Tables are one thing, but authentication and indexes are much different. I can't settle on one style to rule them all...

                                  For example, I want my CREATE TABLE statements to be one-line, if possible, whereas ALTER TABLE is multi-line. When I create or declare temporary objects, I don't care what the definitions are -…

                                  1 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)

                                    We’ll send you updates on this idea

                                    0 comments  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                  • Align to JOIN clause, not INNER, LEFT, etc.

                                    I love that Format SQL will now do alignment. I would like to suggest aligning on the JOIN keywords. The current alignment in SQL Prompt 8 when set to align right will align the first word in a join statement to the right side of the WHERE, so if you have an INNER JOIN and a LEFT OUTER JOIN, the two JOIN words are not aligned with each other, instead the INNER and LEFT are aligned. I would prefer an option to keep the JOINs aligned with the WHERE. I like having all the tables, from the FROM through the…

                                    2 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 →
                                    • Additional options for SELECT aliasing

                                      Add the ability to force the AS keyword in SELECT statements:

                                      SELECT TT.Column1 Alpha FROM dbo.TestTable AS TT
                                      becomes
                                      SELECT TT.Column1 AS Alpha FROM dbo.TestTable AS TT

                                      ----

                                      Add the ability to format SELECT clause aliasing using the Alias = Value syntax:

                                      SELECT TT.Column1 AS Alpha FROM dbo.TestTable AS TT
                                      becomes
                                      SELECT Alpha = TT.Column1 FROM dbo.TestTable AS TT

                                      This would make refactoring INSERTS/UPDATES much more convenient.

                                      1 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)

                                        We’ll send you updates on this idea

                                        1 comment  ·  Format SQL  ·  Flag idea as inappropriate…  ·  Admin →
                                      • Option to force AS clause for table aliases

                                        Add the ability to insure the 'AS' keyword is always used when aliasing tables in FROM/JOIN statements:

                                        SELECT * FROM dbo.TestTable TT
                                        becomes
                                        SELECT * FROM dbo.TestTable AS TT

                                        Allow alignment of AS clauses across joins, even if 'Place on new line' options are not enabled.

                                        3 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 →
                                        • qualify join table name

                                          When writing select queries, I don't always want to qualify all column names with a table or alias name, but when I do a join I want to always have the table name or alias that the column comes from. E.g.:

                                          If you have 2 tables, Table1 and Table2 and each table has 1 Column Table1.Col1 and Table2.Col2

                                          SELECT Col1
                                          FROM Table1
                                          JOIN Table2
                                          ON Col1 = Col2

                                          That query will work just fine, but what I'd like to see when I format it is:

                                          SELECT Col1
                                          FROM Table1
                                          JOIN Table2
                                          ON Table1.Col1 = Table2.Col2

                                          3 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 8 9
                                          • Don't see your idea?

                                          Feedback and Knowledge Base