[Solved] linebreaks into brackets

8 Posts
2 Users
0 Reactions
390 Views
 Idol
(@idol)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

Unpredictable behavior of  the following script :

SELECT *
FROM table1       AS t1 INNER JOIN table2 AS t2
ON  t1.id2= t2.id2

sometimes it provides:

SELECT * FROM table1 AS t1 INNER JOIN table2 AS t2 ON t1.id2 = t2.id2

sometimes:

SELECT *
FROM table1       AS t1
INNER JOIN table2 AS t2
ON  t1.id2 = t2.id2

especially if it's inside brackets:

SELECT *
FROM (table1       AS t1 INNER JOIN table2 AS t2
ON  t1.id2= t2.id2)

settings was not changed during test. 

I have tried for SSMS, java and Win app. 

 

Could you please advise what can be wrong?

 

Thanks in advance

 


   
Quote
 Idol
(@idol)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

Of course my script is more complicated, and linebreaks do not work correctly only in Win app but fine in SSMS and java.

When I tried to simplify the example I found out the result is unpredictable.


   
ReplyQuote
 Idol
(@idol)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

I have found out why the result was different - because of "No breaks for SQL up to 80 Char.

 

However, my original issue still unresolved.

Win app does not formatted JOIN into brackets, java and SSMS do.


   
ReplyQuote
Guido
(@admin)
Member Admin
Joined: 3 years ago
Posts: 216
 

@idol,

many thanks for your feedback.

You are totally correct. The option "No breaks for SQL up to 80 Char." is not available in all Apps.

And the SSMS App is runnung with the Parser Release 5

Recently I created a new parser Release 6 and it looks like I need to add a parsing rule for JOIN in brackets.

Regards

Guido

 


   
ReplyQuote
Guido
(@admin)
Member Admin
Joined: 3 years ago
Posts: 216
 

@idol is the SQL with the JON inside brackets syntactically correct? If yes, for which dB?


   
ReplyQuote
 Idol
(@idol)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

syntax is correct, it's SQL server.


   
ReplyQuote
Guido
(@admin)
Member Admin
Joined: 3 years ago
Posts: 216
 

@idol thanks for your patience. Issue is now fixed in Release 6.23.04.12

Regards

Guido


   
ReplyQuote
 Idol
(@idol)
Member
Joined: 2 years ago
Posts: 11
Topic starter  

@admin thanks, it works nicely.


   
ReplyQuote
Share: