Dear collegues, I am struggeling with finding a good standard for our T-SQL code layout and indentation. Also, I would like to introduce a tool at our company that does the code layout for you. I have a couple of questions.
1. | Do you know of any good tools? |
2. | If so, can you change the layout the tool produces? |
3. | Do you have any advise on the below variants? |
Would you prefer the first variant below, the second variant or another (including a reason why)?
SELECT TAB.name AS ObjectName, COL.name AS ColumnName |
FROM sys.tables AS TAB |
INNER JOIN sys.columns AS COL |
ON (COL.object_id = TAB.object_id) |
WHERE (COL.is_sparse = 0) |
AND COL.is_xml_document = 0; |
SELECT | TAB.name AS ObjectName |
, | COL.name AS ColumnName |
FROM | sys.tables AS TAB |
INNER | JOIN sys.columns AS COL |
| ON (COL.object_id = TAB.object_id) |
WHERE | (COL.is_sparse = 0) |
AND | COL.is_xml_document = 0; |
P.S.: I am struggeling with HTML. Imagine the ON clause in the first statement to be indented four spaces.