Skip to content

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 or our support portal.

SQL Prompt

Categories

JUMP TO ANOTHER FORUM

  • Hot ideas
  • Top ideas
  • New ideas
  • My feedback

172 results found

  1. These are the typical formatting styles I use that I would like to see definable in SQL Prompt. Currently, I use a style that gets me close then manually format the remainder to the code:

    Regarding the desired format of

    1) SELECT, FROM, JOIN, WHERE, GROUP BY, HAVING, ORDER BY all lined up
    2) TAB after SELECT, followed by first 'column'
    3) Subsequent columns on separate lines and lined up with the first one.
    4) TAB after any CASE followed by first WHEN
    5) Subsequent WHENs lined up with first one
    6) TAB before THEN (i.e. indented one tab from…

    4 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  2. I would like to only affect the placement of commas in a column list, without applying other formatting options. This would work similar to Ctrl-B, Ctrl-B to remove brackets or Ctrl-B, C to insert semicolons, in that no other formatting would take place.

    There are times I have a rather well-formatted script but it has been written with commas at the start of the line and I prefer them at the end. A new shortcut would toggle placing commas at the start or end of the line without affecting other formatting within the script.

    5 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  3. I have different wants for parentheses rules: Collapse short content or not, Having Parentheses on separat lines or leading the content, etc. It all depends on the context. But currently the setting is global.

    I would like to be able to define one rule for, say, Primary Key definitions, and another rule for, say, the columns of a table.
    I would want one thing for Control Flow sections, and another thing for Variables declarations.

    Today, I need to choose which one to be dominant (or stop using FORMAT SQL on the entire script, but just highlight the block where I…

    3 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  4. In SQL Prompt, Formatting Styles, I would like to differentiate the “Short parentheses contents” behavior, so it didn’t impact the primary key when I add a Constraint Primary Key Clustered at Create Table time.
    I like my PK fields to stand out, not hide in a block of text.
    But I also like any other listing of a few fields to be kept on a single line, and not bloating the screen for no reason at all.
    Currently, I can’t have both.

    In short, I want

    CREATE TABLE dbo.Orders
    (
    OrderDate DATETIME NOT NULL,
    OrderID INT NOT NULL,
    CustomerID INT…

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  5. Currently SQL Prompt only has one option for formatting insert statements which poses a problem for us with multi value set inserts.

    Ideally we'd be able to select a formatting for a single value set insert and another format for a multi value set insert.

    This would allow us to do something like this:

    -- Single Value Set Insert
    INSERT INTO TestTable (TestName,
    ~~~~TestValue,
    ~~~~TestDate)
    VALUES (N'Something',
    ~~~~140,
    ~~~~'1/1/2019')

    -- Multi Value Set Insert
    INSERT INTO TestTable (TestName, TestValue, TestDate)
    VALUES (N'Something', 140, '1/1/1900'),
    ~~~~(N'SomethingElse', 150, '1/2/1900'),
    ~~~~(N'SomethingElse2', 160, '1/2/2000')

    The issue for us is that we have need of…

    10 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  6. I would like to control the list behavior on a clause by clause basis so that I can separate the formatting on my DECLARE statements differently than lists within SELECT and INSERT statements. As it stands, these are conflicting changes. So, the only way to get each variable declared on a separate line is to also have every column in other statements on a separate line. I'd like to be able to do BOTH of these:

    DECLARE @GUID UNIQUEIDENTIFIER = NEWID(),
    @Char CHAR(1) = 'A',
    @Int INT = 1,
    @Datetime DATETIME = CURRENTTIMESTAMP,
    @Decimal DECIMAL(18,10) = 1.0,
    @Date DATE

    2 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  7. I write a LOT of unit tests, usually at the rate of 15:1 to 20:1 to my executing code. I have these standardized and templated to make them easier and more consistent to build. e.g. @GUID UNIQUEIDENTIFIER = NEWID(),
    @Char CHAR(1) = 'A',
    @Int INT = 1,
    @Datetime DATETIME = CURRENTTIMESTAMP,
    @Decimal DECIMAL(18,10) = 1.0,
    @Date DATE = CURRENT
    TIMESTAMP,
    @Time TIME = CURRENT_TIMESTAMP,
    @Bit BIT = 1,
    @Money MONEY = 1.00,
    @Binary VARBINARY(18) = 0x01,

    These go into my VALUES clause for INSERT statements, but I current have to do all of this manually, which takes a LOT…

    2 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  8. It would be nice if SQL Prompt had a way to add in the code DROP TABLE IF EXISTS #table for temp tables. Ideally it would add the statement immediately before the table is created from a CREATE TABLE or SELECT INTO statement.

    11 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  9. Sometimes I set a variable equal to many strings concatenated together using the "+" syntax. When I format with Regdate, there is no option to wrap lines in this case. Everything ends up on the same line as the SET, so the lines often get very wide and go off screen.
    It would be great if there was an option to wrap text if things got too wide horizontally.
    One solution would be a setting to format concatenated strings like this:
    SET @Variable = N'String1'
    + N'String2'
    + N'String3'

    4 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    2 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  10. It seems that the contents and closing parenthesis of EXISTS and APPLY clauses is not being indented as I would expect. So either i'm weird....or Format SQL is doing it wrong?

    I'm using (
    .....this parentheses style
    )

    What it's doing:

    SELECT *
    FROM tblA a
    WHERE 1 = 1
    .....AND EXISTS (
    .....SELECT *
    .....FROM tblB b
    .....WHERE b.Col1 = a.Col1
    ..........AND b.Col2 = a.Col2
    ..........AND b.Col3 = a.Col3
    )

    What I expect:

    SELECT *
    FROM tblA a
    WHERE 1 = 1
    .....AND EXISTS (
    ..........SELECT *
    ..........FROM tblB b
    ..........WHERE b.Col1 = a.Col1
    ...............AND b.Col2 = a.Col2
    ...............AND…

    3 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  11. Support request #137199: Provide an option to indent AND/OR entries in a WHERE clause to line up indented, but leave AND/OR entries directly underneath ON clauses:

    SELECT
            t1.col5
            , t2.col6
    FROM
            table1 t1
            INNER JOIN table2 t2
                    ON t1.col1 = t2.col1
                    AND t1.col2 = t2.col2 -- AND is directly below ON clause
    WHERE
            t1.col3 = 'Test'
            AND t2.col4 = 5 -- AND is indented underneath WHERE

    2 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  12. SQL Prompt fails badly in formatting window functions. As these are present at least since SQL 2014, SQL Prompt should be able to interpret them and format them accordingly.

    Example:

    I would format the LAG() function as follows:

    SELECT
    myColumn AS realColumn
    ,LAG(myColumn, 1, 0)
    OVER (
    PARTITION BY someColumn
    ORDER BY anotherColumn) AS calculatedColumn

    Try this with SQL Prompt - it's result is not very nice...

    4 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  13. Would it be possible to treat the 'LIKE' operator the same as '=' in the Expressions\Operators settings so they are all aligned?

    select AddressID
    from Person.Address
    where ModifiedDate
    between dateadd(month, -6, getdate())
    and getdate()
    and City = 'Bothell'
    or left(PostalCode, 2) like 'CB%'
    or PostalCode = @prefix + @suffix

    2 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  14. When I type code I like to line up all the equals (=) signs using tabs so that all the code to the right of the equals sign lines up nicely on my screen. I find this really useful for improving readability when using column aliases, in joins, and in update statements.
    I can't find an option in SQL Prompt to do this and it annoys me when I format my SQL and all the equals signs become ragged.

    2 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  15. The starting item in a List of Columns for a SELECT statement is fine to place on the same line as the SELECT, however, for EXEC <proc name that is probably longer> it looks odd to have the Parameters line up at the end. This should be a separate choice for EXEC Parameters. I chose the "commas before" style for most everything, but prefer the "default" layout for EXEC proc parameters.

    4 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  16. Refactoring INSERT into UPDATE is definitely useful, but most of us are familiar with these. The complex MERGE statement is a mess, and a clean way to generate that would be fantastic!! Especially since you can figure out the primary keys, etc..

    4 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  17. The only edge Apex has over SQL Prompt formatting, at least for my use, is being able to organize long equations. If I am using a large number of columns for an equation, I'd like to place each new column on a new line.

    1 vote

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  18. Changing

    SELECT TOP 10...

    to

    SELECT TOP (10)... should be a formatting option.

    11 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  19. It's currently possible to align operations in WHERE which is great, but BETWEEN is not aligned.
    Example - currently:
    WHEREModifiedDate BETWEEN DATEADD(MONTH, -6, GETDATE()) AND GETDATE()
    AND City
    __________= 'Bothell'
    OR LEFT(PostalCode, 2)
    = 'CB'
    OR PostalCode
    _______= @prefix + @suffix

    Expected:
    Example - currently:
    WHEREModifiedDate_BETWEEN DATEADD(MONTH, -6, GETDATE()) AND GETDATE()
    AND City
    ________= 'Bothell'
    OR LEFT(PostalCode, 2)
    = 'CB'
    OR PostalCode
    _______= @prefix + @suffix

    3 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  20. Options - Styles pane contains, for example, "Apply column alias style" and its drop-down. This does not belong as a universal style setting, among others.

    Please move it to the "Formatting Styles" configuration dialog.

    This is because many practitioners either do not know about the "alias = column" capability in T-SQL, or don't like it, or it's contrary to company standards. The ability to use this form, which IMO is more brain-friendly, ought to be on the Formatting page as it is, in fact, a significant style element.

    Thanks.

    4 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Format SQL  ·  Admin →
    How important is this to you?

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)
  • Don't see your idea?