Options

Problem with multiple parenthesis and aligment with 'exists' and 'and'

EsioNunesEsioNunes Posts: 2 New member
edited May 13, 2019 5:24PM in SQL Prompt
Hi. I made an example of the gaps I have trying to format some statements.
Can you give me a glue, what's wrong?

begin
	select	*
	from	tab1
	where col1 = 1
			and colb = '1'
			and
			( --Case 1: OK parentesis in the new line
				colz is not null --OK contents in the new line and indented
				and colz = 'X' -- OK 'and' in the new line
			)
			and --retyping the previous statement and including more statements
			( --Case 2: OK parentesis in the new line
				col1 = 'd'
				and
				(
					colz is not null --OK contents in the new line and indented
					and colz = 'X' -- OK 'and' in the new line
				)
			)
			and ( --Case 3: NOT OK parentesis not in the new line
		( --parentesis not indent, the difference between Case 2 and Case 3 is the "cola = 'd' and"
			colz is not null --OK contents in the new line and indented
			and colz = 'X' -- OK 'and' on the new line
		)
				)
			and exists --OK: and exists on the new line
	(	--Case 4: NOT OK: parentesis aligned to the where, not aligned to the 'and exists' or indented to the 'and exists'
		select * from		tabB
	);
end;
Attached, a picture of my SSMS screen and my format style.

Comments

  • Options
    Nikos226Nikos226 Posts: 14 New member
    edited August 22, 2019 7:38PM
    It's unfortunate there's no reply to this post. I would like to bump this and see if this can be reviewed.

    I'm having the exact same issue where the formatting is clashing on the formatting with PARENTHESIS and OPERATOR->AND/OR formatting, specifically when used with the EXISTS clause.

    I attached my formatting style, and the screen compares SQL Prompt to Poor Mans' TSQL Formatter

    Thank you.





Sign In or Register to comment.