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. 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)
  3. 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)
  4. 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)
  5. 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)
  6. The "Remove Square Brackets" option does not work for "CREATE EXTERNAL TABLE" statement.

    Please try this option with the example below and nothing happens.

    CREATE EXTERNAL TABLE [ft].[Account]
    (
    [AccountId] [bigint] NOT NULL,
    [AccountType] [nvarchar] (50) COLLATE NOT NULL,
    [AccountCreatedDate] [datetime2] NOT NULL
    )
    WITH
    (
    DATASOURCE = FinancialDB,
    SCHEMA
    NAME = 'Account',
    OBJECT_NAME = 'Account'
    );

    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. 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)
  8. I'd like a NuGet lib to be able to apply SQL Prompt styles to a folder of .sql files or a StreamReader string. I have a console app I'm using to produce a lot of Sql Files and I'd like to create a "everything on one-line" style that I use internally when processing things. There could be tons of other uses as well.

    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)
  9. Current formatting is:

    CASE
    WHEN 1 = 1 THEN
    'Hello World'
    END

    I need the option to put the expression on the same line:

    CASE
    WHEN 1 = 1 THEN 'Hello World'
    END

    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)
  10. 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)
  11. 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)
  12. 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)
  13. 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)
  14. If a sql command is written with an APS specific statement (for example: "CREATE TABLE AS, or "OPTION (Label = 'Query Description')" ), then a script parsing error appears.

    9 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. Please add an option be added to SQL Prompt to trim all white space.

    Ideally, the following would be supported:
    - Ability to execute against a query window or block of selected code
    - Available as a stand-alone shortcut
    - Can include as part of a Format SQL style
    - Option to remove a) leading spaces, b) trailing spaces, c) both

    8 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)
  16. 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)
  17. Would like to control formatting of the OVER clause. E.g I would like the complete "(Partition by ... order by ...) as xyz" on one line, but today it's overrdden by other options.

    28 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)
  18. 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)
  19. 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)
  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?