What are the challenges you face when working across database platforms? Take the survey
Options

"New line" behavior in the FROM clause

a.higginsa.higgins Posts: 90 Bronze 2
edited September 16, 2016 8:54AM in SQL Prompt
Under Global --> Lists --> List Items, I have the "Place first item on new line" option set to "if there are subsequent items".

When I try to format the following query, the first table name in my FROM clause is left on the same line:
SELECT
	tables.name
   ,columns.name
FROM sys.tables
	LEFT OUTER JOIN sys.columns
		ON tables.object_id = columns.object_id

However, if I set the "Place first item on new line" option to "Always", the table moves down to the line after the FROM:
SELECT
	tables.name
   ,columns.name
FROM
	sys.tables
	LEFT OUTER JOIN sys.columns
		ON tables.object_id = columns.object_id

I'm not sure what's driving this behavior, exactly, but I would expect that when referencing two or more tables in the FROM clause, the "if there are subsequent items" option would trigger and dictate that the first table be placed on a new line, as in the "Always" example code above.

Comments

Sign In or Register to comment.