Suggestion for enclosing identifiers in square brackets

Bart ReadBart Read Posts: 997 Silver 1
edited August 7, 2015 1:15PM in SQL Prompt
Hi there,


I'm a big fan of SQL Prompt's ability to customise the formatting of your SQL to suit the situation.

However, today I've run across a quirk working with:

- enclose identifiers in square brackets,
- column list expansion with an alias

Here's what I mean. Say I start with:
SELECT n.* FROM [gen].[PHONE_NUMBER_MST] AS n

If I place the caret after n.* and hit TAB SQL Prompt will insert all of the columns for me. What I'd like is this:
SELECT n.[PhoneGUID] ,
       n.[CountryKey] ,
       n.[PhoneNumber] ,
       n.[BadNumberCount] ,
       n.[IsDoNotCall] ,
       n.[UpdateDate] ,
       n.[UpdateSessionGUID] ,
       n.[PhoneNumberTypeKey] FROM [gen].[PHONE_NUMBER_MST] AS n

Instead what I end up with is this:
SELECT [n].[PhoneGUID] ,
       [n].[CountryKey] ,
       [n].[PhoneNumber] ,
       [n].[BadNumberCount] ,
       [n].[IsDoNotCall] ,
       [n].[UpdateDate] ,
       [n].[UpdateSessionGUID] ,
       [n].[PhoneNumberTypeKey] FROM [gen].[PHONE_NUMBER_MST] AS n

Rather than add another option to SQL Prompt's options dialog (although this would be a workable solution) it would be great if it would match the style I use for aliases automatically, in this case without braces.

Hope that's useful.


Thanks,
Bart Read
Principal Consultant
bartread.com Ltd

Comments

  • Aaron LAaron L Posts: 596 New member
    Hi Bart,

    Thanks for your post!

    We're wondering if this might work better as sub-option of our existing square brackets option as there's a few places (such as auto-generating an alias when a table is completed in the FROM clause) where Prompt wouldn't have the reference alias to use and could be inconsistent with your preferred style.

    We currently use a UserVoice forum for feature requests so that's probably the best place to post this idea as it'll allow other users who are interested vote on it and get notified of any progress.

    Thanks,
    Aaron.
Sign In or Register to comment.