Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Suggestion for good T-SQL code formatting rules and tools

$
0
0
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;


SELECTTAB.name AS ObjectName
,COL.name AS ColumnName
FROMsys.tables AS TAB
INNERJOIN sys.columns AS COL
ON (COL.object_id = TAB.object_id)
WHERE(COL.is_sparse = 0)
ANDCOL.is_xml_document = 0;

P.S.: I am struggeling with HTML. Imagine the ON clause in the first statement to be indented four spaces.

Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>