How can we help you today? How can we help you today?

Inconsistent new line behavior with VALUES clause

The settings for the VALUES clause does not seem to be correctly determining when to insert a new line, depending on the 'Commas' option within lists.

If I set Global --> Lists --> Commas --> Place commas before items, the two sets within my VALUES clause aren't separated by a new line:
;WITH Departments AS
	(
		SELECT
			'DEPT1'			 AS Dept_1
		   ,'Department One' AS Dept_1_Desc
		   ,'DEPT2'			 AS Dept_2
		   ,'Department Two' AS Dept_2_Desc
	)
SELECT
	unpvt.Department
   ,unpvt.DepartmentDescription
   ,unpvt.DepartmentNumber
FROM
	Departments
	CROSS APPLY
	(
		VALUES
			(
				Departments.Dept_1
			   ,Departments.Dept_1_Desc
			   ,1
			), (                                                                                          -- this opening parentheses should be on a new line
				   Departments.Dept_2
				  ,Departments.Dept_2_Desc
				  ,2
			   )
	) unpvt (Department, DepartmentDescription, DepartmentNumber)

However, if I set Global --> Lists --> Commas --> Place commas after items, the parentheses within my VALUES clause are lined up correctly:
;WITH Departments AS
	(
		SELECT
			'DEPT1'			 AS Dept_1,
			'Department One' AS Dept_1_Desc,
			'DEPT2'			 AS Dept_2,
			'Department Two' AS Dept_2_Desc
	)
SELECT
	unpvt.Department,
	unpvt.DepartmentDescription,
	unpvt.DepartmentNumber
FROM
	Departments
	CROSS APPLY
	(
		VALUES
			(
				Departments.Dept_1,
				Departments.Dept_1_Desc,
				1
			),
			(                                                                                               -- yay! This is on a new line now.
				Departments.Dept_2,
				Departments.Dept_2_Desc,
				2
			)
	) unpvt (Department, DepartmentDescription, DepartmentNumber)

Since I like to have my commas before items, can this be changed to correctly interpret the VALUES clause and add a new line between sets?
a.higgins
0

Comments

3 comments

  • James R
    Hi,

    Thanks for reporting this issue, we've managed to reproduce it and are looking into it.

    Thanks,
    James
    James R
    0
  • James R
    Hi a.higgins,

    We've just released a new beta build (7.3.0.610) which should fix this issue and the IN statement alignment issue that you were seeing.

    Please give it a go and let us know it you have any other issues :)
    Thanks,
    James
    James R
    0
  • a.higgins
    Confirmed, the newest release addresses this issue.
    a.higgins
    0

Add comment

Please sign in to leave a comment.