Comments
9 comments
-
Here's another one:
select col1, col2, col3 as blah from tbla cross join ( select col1, col2, col3 from tblb ) x
... becomes:select col1, col2, col3 as blah from tbla cross join ( select col1, col2, col3 from tblb ) x
But what I want is (based on the current behavior of the product in other cases):select col1, col2, col3 as blah from tbla cross join ( select col1, col2, col3 from tblb ) x
-
It's rare that I disagree with Adam, but I dont favor this output:
select * from tbla join tblb on tbla.id = tblb.id
I hate this too though (in fact I would rather have his suggestion than this)select * from tbla join tblb on tbla.id = tblb.id
I always do it this way, because I don't feel that a JOIN is on the same level as the FROM clauseselect * from tbla join tblb on tbla.id = tblb.id join tblc join tblcsCousin on tblcsCousin.id = tblc.id on tblc.id = tblb.id
This is however, one thing I am really looking forward to with your tool. I get some code, click a button and bam, it is in my style, then he gets it and can do the same thing.
I think it is imperative that the output be as configurable as possible, with every concievable (and reasonable) possibility. -
drsql wrote:...
I think it is imperative that the output be as configurable as possible, with every concievable (and reasonable) possibility.
We are trying. At the moment we have almost thirty options, and many of the suggested options mentioned on this forum will make it into the final release. But of course for every option added there will be five more waiting to be considered.
Thank you for the option suggestions, we will consider them and if time permits include many of them.
Andras -
I didn't realize it, but it lost my formatting:
select * from tbla join tblb on tbla.id = tblb.id join tblc join tblcsCousin on tblcsCousin.id = tblc.id on tblc.id = tblb.id
I will edit the original post too. -
drsql wrote:I didn't realize it, but it lost my formatting:
select * from tbla join tblb on tbla.id = tblb.id join tblc join tblcsCousin on tblcsCousin.id = tblc.id on tblc.id = tblb.id
I will edit the original post too.
Many thanks,
Andras -
I'm not sure how difficult it would be (probably really, really difficult), but if you wanted the ultimate formatter, you could give the user several sample SQL fragments (enough to get a consistent baseline), and let the user reformat them however he or she sees fit. Then the rules engine could evaluate the reformatted SQL and come up with rules that would conform with it (or, set the available options appropriately). Probably far in the future of the product, but perhaps something to start thinking about
-
amachanic wrote:I'm not sure how difficult it would be (probably really, really difficult), but if you wanted the ultimate formatter, you could give the user several sample SQL fragments (enough to get a consistent baseline), and let the user reformat them however he or she sees fit. Then the rules engine could evaluate the reformatted SQL and come up with rules that would conform with it (or, set the available options appropriately). Probably far in the future of the product, but perhaps something to start thinking about
Well, as many times, you are absolutely right. It does sound like a very interesting idea. While it is not possible to deduct all the preferred settings from a set of indented scripts, the tool could potentially show some learning qualities, and if its own indentation is "corrected" by the user, it could adapt.
This of course is way beyound the scope of the first version. We have not included all the refactorings in the CTP, there is more in the queue. The more popular ones will get more resources in the future. If it happens to be the SQL Layout, the above way of extension could become reality.
Regards,
Andras -
I could not find a way to keep the column list on GROUP BY and ORDER BY on their own lines. It currently changes my code to this:
select sum(sp.qty) as qty
, e.territory_number
from sample_product sp
join enrollment e on sp.nah_customer_id = e.nah_customer_id
where sp.tracking_form_date >= '2006-1-9 00:00:00.000'
group by
e.territory_number
order by
e.territory_number
But I would like to have the columns on the group by and order by columns on the same line as the reserved word. I also wish the JOIN statement would line up with SELECT, FROM, WHERE, GROUP BY and ORDER BY. I cannot understand why it is indented. Perhaps I am missing something.
select sum(sp.qty) as qty
, e.territory_number
from sample_product sp
join enrollment e on sp.nah_customer_id = e.nah_customer_id
where sp.tracking_form_date >= '2006-1-9 00:00:00.000'
group by e.territory_number
order by e.territory_number -
I wants "Same JOINs & ONs indent formating" too
SELECT * FROM dbo.t1 INNER JOIN dbo.t2 ON dbo.t1.id = dbo.t2.id INNER JOIN dbo.t3 INNER JOIN dbo.t4 ON dbo.t3.id = dbo.t4.id ON dbo.t2.t4_id = dbo.t4.id
Add comment
Please sign in to leave a comment.
I end up with this:
This one drives me crazy. There is no reason to indent a JOIN -- it's logically at the same level as the FROM clause. So what I want is:
Another one:
...becomes:
I'd like the option of instead having it do something like:
Note, I see that it DOES behave that way when DISTINCT or TOP are present -- how about an option to make it always behave as if those options are there?