Author Topic: SQL Indentation and Reindentation (Beautify)  (Read 5198 times)

Absinthe

  • Guest
SQL Indentation and Reindentation (Beautify)
« on: August 09, 2009, 12:22:06 am »
One of the common styles of SQL indentation involves right justifying the KEYWORDS while left justifying the items that follow until a blank line for example:


SELECT_ This, That,
        These, Those
  FROM_ MyTable
 WHERE_ This = 7
   AND_ That = 9
 ORDER_ BY_ This



(ignore the underscores, apparently this forum software is hinky about some text)

Apparently, in its current release SE does not support this style. However, even if it did it would be nice if the Beautify command would act on the buffer to format based on the current language settings for indentation and so forth.

In addition, I am not sure if putting a beautify command (especially one that only half way works on only a very few language options) in the editor is a good use of resources. Wouldn't this be a better candidate for shelling to TIDY or INDENT or does that SQLInform have some sort of way to be shelled out and back into the editor without having to screen scrape to and from a web site?

Point is, if I adopt a style or mandate it from my developers, I need to be able to reformat existing code, and have a way to makeit convenient to type it in correctly initially.