Options

"don't layout" tags

austrianfoodispukeaustrianfoodispuke Posts: 100
edited June 24, 2008 9:33AM in SQL Prompt Previous Versions
Seeing as it keeps trashing my nicely aligned column aliases....

Can you introduced a comment based tag (or bookmark style thingy) to not layout code between certain sections?

Comments

  • Options
    Hi,

    We are currently planning for SQL Prompt v4.0 and will include this into our review list.
    Out of interest, how do you like the column aliases to be aligned? Maybe if it is something which most people would prefer that could possibly go as default style or as an option?

    Thanks,
    Tanya
    Project Manager
    Red Gate Software Ltd
  • Options
    SSMS Tools has a "debug section" feature and becomes commented out if you run under the "Release" mode, very like VS

    Ctrl-K, Ctrl-D
    #-BeginDebug
    
    #-EndDebug
    

    Perhaps we can see
    #-BeginNoLayout
    
    #-NoLayout
    

    Disable some sections for layout is good, especially when I create mass-insert code and intentionally make it 1 row insert for 1 line if I can
    and I believe SQL Prompt lays it out, 1 line per comma

    Imagine if I created a insert stmt for entire table (thru SSMS tool), 1000 rows, and lay it out :)
            SELECT  10,'52','Saint Philip','PH'  UNION ALL
            SELECT  11,'52','Saint Thomas','TH'
    
    lays out to
            UNION ALL
            SELECT  10,
                    '52',
                    'Saint Philip',
                    'PH'
            UNION ALL
            SELECT  11,
                    '52',
                    'Saint Thomas',
                    'TH'
    
    Jerry Hung
    DBA, MCITP
  • Options
    I usually line them up somewhere around the 80th column.

    This is also useful when using the little known ALT + <select text> to get a box select for copying to excel/notepad++
  • Options
    jerryhung wrote:
    SSMS Tools has a "debug section" feature and becomes commented out if you run under the "Release" mode, very like VS

    Ctrl-K, Ctrl-D
    #-BeginDebug
    
    #-EndDebug
    

    Perhaps we can see
    #-BeginNoLayout
    
    #-NoLayout
    

    Disable some sections for layout is good, especially when I create mass-insert code and intentionally make it 1 row insert for 1 line if I can
    and I believe SQL Prompt lays it out, 1 line per comma

    Imagine if I created a insert stmt for entire table (thru SSMS tool), 1000 rows, and lay it out :)
            SELECT  10,'52','Saint Philip','PH'  UNION ALL
            SELECT  11,'52','Saint Thomas','TH'
    
    lays out to
            UNION ALL
            SELECT  10,
                    '52',
                    'Saint Philip',
                    'PH'
            UNION ALL
            SELECT  11,
                    '52',
                    'Saint Thomas',
                    'TH'
    

    Hello,

    I can see what you mean:)
    We will log this into our database and hopefully address it in our future versions.

    Meanwhile, if it helps at all for the particular example stated, you can set the options to lay out the values in the same line(Layout - Data Statements - Uncheck 'Place subsequent columns on a new line') and when you lay out, it would look like:

    SELECT 10, '52', 'Saint Philip', 'PH'
    UNION ALL
    SELECT 11, '52', 'Saint Thomas', 'TH'


    Thanks,
    Tanya
    Project manager
    Red Gate Software Ltd
  • Options
    tanya wrote:
    Hello,

    I can see what you mean:)
    We will log this into our database and hopefully address it in our future versions.

    Meanwhile, if it helps at all for the particular example stated, you can set the options to lay out the values in the same line(Layout - Data Statements - Uncheck 'Place subsequent columns on a new line') and when you lay out, it would look like:

    SELECT 10, '52', 'Saint Philip', 'PH'
    UNION ALL
    SELECT 11, '52', 'Saint Thomas', 'TH'


    Thanks,
    Tanya
    Project manager
    Red Gate Software Ltd

    Good suggestion Tanya
    However unchecking that will cause more headache instead

    From your Preview code, checkbox checked for comma
    SELECT  staffId,
            staffName,
            a
    FROM    personnel
            INNER JOIN &#40; SELECT a
                         FROM   b
                       &#41; AS ab ON personnel.a = ab.a
    

    once I unchecked that, SELECT statement becomes 1 line.
    SELECT  staffId, staffName, a
    FROM    personnel
            INNER JOIN &#40; SELECT a
                         FROM   b
                       &#41; AS ab ON personnel.a = ab.a
    

    I prefer in SELECT statement 1 line per column, unless it's for the mass insert operation. Which is totally almost impossible for SQL Prompt to know

    Thanks for the reply!
    Jerry Hung
    DBA, MCITP
Sign In or Register to comment.