SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Again code formatting

 
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant View previous topic
View next topic
Again code formatting
Author Message
Casso



Joined: 03 Jul 2008
Posts: 9
Country: Russian Federation

Post Again code formatting Reply with quote
Hello,

I have problem with code formatting tool
here is the source code
Code:
DECLARE @aMonth int, @bMonth int, @cMonth int
set @aMonth = (select a_code from spr_month where a_id = 1)
set @bMonth= (select a_code from spr_month where a_id = 2)
set @cMonth= (select a_code from spr_month where a_id = 3)


code after formatting
Code:
DECLARE @aMonth int, @bMonth int, @cMonth int
SET @aMonth = (SELECT a_code
               FROM   spr_month
               WHERE a_id = 1)
               SET @bMonth= (SELECT a_code
                             FROM   spr_month
                             WHERE a_id = 2)
                             SET @cMonth= (SELECT a_code
                                           FROM   spr_month
                                           WHERE a_id = 3)


the problem is that the code after the ")" don't start from the beginning

another problem
source:
Code:
SELECT *
FROM aaa
INNER JOIN bbb
ON aaa.a = bbb.b
AND (aaa.a = 1 OR aaa.a = 2)
INNER JOIN ccc
ON ccc.c = aaa.a


formatted:
Code:
SELECT *
FROM aaa
   INNER JOIN bbb
      ON aaa.a = bbb.b
      AND (aaa.a = 1
      OR aaa.a = 2)
   
    INNER JOIN ccc
      ON ccc.c = aaa.a


your tool add empty line between join's, and if i do format again it will be two empty lines...

Sorry, i have bad English =(
Thu Jul 03, 2008 6:41 am View user's profile Send private message
Casso



Joined: 03 Jul 2008
Posts: 9
Country: Russian Federation

Post Reply with quote
SQL Assistant v 3.5.21

select template
Code:
SELECT ... AS ...,
   ... = ...,
   ( ... )
FROM ... AS ..., ...
   JOIN ...
      ON ...
      ON ... = ...
      AND ...
      OR (...)
WHERE ... = ...
   AND ...
   OR (...)
GROUP BY ..., ...
HAVING ..., ...
ORDER BY ..., ...

Thu Jul 03, 2008 6:44 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7840

Post Reply with quote
This looks like an issue with code formatter. For some reasons it treats consecutive SET = (query) as if they were subqueries. I am going to submit this issue to our bug tracking system. Hope it will be fixed in one of the following maintenance releases


Last edited by SysOp on Thu Jul 03, 2008 9:32 am; edited 1 time in total
Thu Jul 03, 2008 8:12 am View user's profile Send private message
Casso



Joined: 03 Jul 2008
Posts: 9
Country: Russian Federation

Post Reply with quote
Thanks,
what about the second problem?
Thu Jul 03, 2008 8:49 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7840

Post Reply with quote
I submitted that too. I think that empty line is caused by the expression in brackets and line wrapping, not by the second INNER JOIN.
Thu Jul 03, 2008 9:34 am View user's profile Send private message
Casso



Joined: 03 Jul 2008
Posts: 9
Country: Russian Federation

Post Reply with quote
The second join was added just to show new empty line =))
Thanks a lot
Thu Jul 03, 2008 10:59 am View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » SQL Assistant All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.