Right align on the first keyword in multi keywords like LEFT JOIN  

  

0

Currently when you pick right align on key words it will right align to the second word of multi words.  This causes the select statement to start off indented several characters.  I would like an option to make sure the select statement always starts in the column we provide (in this case column 1).   Example

       SELECT x

          FROM table.name

 LEFT JOIN table name

                ON x = x

I would like it to right align on the first keyword in the set.  In this case the word LEFT.

SELECT x

   FROM table.name

     LEFT JOIN table.name

          ON x = x

 

7 Answers
0

Hi Lynnl,

the keywords "SELECT", "FROM", "LEFT JOIN", "LEFT OUTER JOIN", "ORDER BY", etc. are justified on the 1 char (just leftify) or on the last char "right justify". Your idea (I like it) would require an additional justify option, something like "justify right on 1st keyword". This is not possible with today available options but I will think about it...

For now I could only recommend to set the number of spaces used for indeting to "7". This will keep the "SELECT" on the 1st column. It is not perfectly what you are looking for but maybe helpful for now (see attachm.)

Regards

Guido

0

Hi LynnL,

here is the output of a first test, please see attachm. Is it this format you are suggesting?

Regards

Guido

0

Hi Guido,

Yes, that is exactly what I was talking about.  Thank you so much for working on this.  I do have a couple of questions though, based on your output.  If I have the settings turned on to have a return before each 'on' would the 'on' be right justified to the word 'left' in 'left outer join' and to the word 'inner' on 'inner join'?  Also is it still possible to have the setting to make the 'and' right justify to the 'where'?

Thank you,

Lynn

Hi Lynnl,
just to let you know that I did not forget your request. I have to restructure the GUI to include the new request. hope to finish in a couple of days

0

Thank you for keeping me posted!  I appreciate you jumping on this so quickly.

0

Please have a look here: https://www.sqlinform.com/npp-history/

and try the new option "Use small keyword length" on the "General Options" tab.

Hope it works as expected

REgards

Guido

0

That is the plugin for notepad ++.  I have the full pro version.  I tried downloading notepad ++ and installing the DLL, but a lot of the options are greyed out so I can't get the SQL to look like I want it to.  I tried switching between the use small/large and I never got it to look exactly like my example in the original post.   I like my keywords to be right aligned  (SELECT, FROM, JOIN, LEFT JOIN), but if there are multiple keywords like LEFT JOIN i want it to be right aligned on the first word of the pair not the last word.  Does that make sense?  My example below shows right aligning on the word LEFT.   If I pick right align now I get a right align on the word JOIN and then it pushes the select inward and indents the entire SQL further to the right.   Basically, I want the select to be starting on column 1 all the time.

I want this:

SELECT x

   FROM b

    LEFT JOIN

 

Not this:

      SELECT

         FROM

LEFT JOIN

0

Hi Lynnl,

please have a look to the screenshot attached. You need to enter your credentials in the license tab.

and please set the formatting option as shown in the screen shot. It should be what you are expecting.

If you are happy I will copy the new logic also to the desktop application.

 

Your Answer


 
Share: