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.

3
  • 1
    SQL PRompt (redgate) has an option to allow aligning aliases. Integrates with SSMS and Visual Studio as well. ... Sorry, you said database agnostic.... Jun 6, 2018 at 20:02
  • 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 7, 2018 at 10:32

1 Answer 1

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.