2

Is there a tool out there that will take sql and align it vertically?

what I have:

SELECT first_name AS foo
      ,last_name AS bar
      ,ssn AS bas
      ,address AS chu
FROM dbo.contacts;

desired results or something similar to the statement below:

SELECT first_name AS foo
      ,last_name  AS bar
      ,ssn        AS bas
      ,address    AS chu
FROM dbo.contacts;

My team has been using http://poorsql.com/ to line things up, but it would be nice to be able to make use of white space and have our AS statements line up without having to manually format everything.

  • 1
    SQL PRompt (redgate) has an option to allow aligning aliases. Integrates with SSMS and Visual Studio as well. ... Sorry, you said database agnostic.... – Jonathan Fite Jun 06 '18 at 20:02
  • http://extras.sqlservercentral.com/prettifier/prettifier.aspx – Erik Darling Jun 06 '18 at 22:16
  • I don't feel that this question is off-topic - it mightn't seem like a very technical question, but it is related to databases and SQL and might be useful for some people! To the OP, why don't you ask the provider of the programme if that could be added as a feature? – Vérace Jun 07 '18 at 10:32

1 Answers1

0

I know that ApexSQL Refactor ( https://www.apexsql.com/sql_tools_refactor.aspx ) will cover the aliases as preset option, not sure about AS without doing some digging.

Just Will
  • 1
  • 3