 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
citymail
Joined: 03 Jun 2008 Posts: 4 Country: Sweden |
|
Code formatting |
|
Hi,
I would like to format my using the editable code format templates as follows. But I can't really get it to format as I want
The most difficult is the join and where I want additional ANDīs etc look below.
Is it possible?
 |
 |
-- Whit typing assistance i get
SELECT * FROM dbo.fbAddress fa
INNER JOIN dbo.fbAddressEntrance fae
ON fae.AddressId = fa.AddressId
-- after applying CTRL+F11 I want the following
SELECT *
FROM dbo.fbAddress AS fa
INNER JOIN dbo.fbAddressEntrance AS fae ON fae.AddressId = fa.AddressId
--Notice the applied as AS
-- If the join has more terms
-- Whit typing assistance
SELECT * FROM dbo.fbAddress fa
INNER JOIN dbo.fbAddressEntrance fae
ON fae.AddressId = fa.AddressId
AND fae.EntranceTypeId = fa.EntranceTypeId
INNER JOIN dbo.fbStreetName fsn
ON fsn.StreetNameID = fa.StreetNameId
-- after applying CTRL+F11 I want the following
SELECT *
FROM dbo.fbAddress AS fa
INNER JOIN dbo.fbAddressEntrance fae AS ON fae.AddressId = fa.AddressId
AND fae.EntranceTypeId = fa.EntranceTypeId
INNER JOIN dbo.fbStreetName AS fsn ON fsn.StreetNameID = fa.StreetNameId
--Notice the applied as AS and the positon of the AND |
|
|
Tue Jun 03, 2008 9:39 am |
|
 |
citymail
Joined: 03 Jun 2008 Posts: 4 Country: Sweden |
|
|
|
Hmm Formatting issues in the formum post editor as well ;).
It shoul be
 |
 |
-- after applying CTRL+F11 I want the following
SELECT *
FROM dbo.fbAddress AS fa
INNER JOIN dbo.fbAddressEntrance fae AS ON fae.AddressId = fa.AddressId
AND fae.EntranceTypeId = fa.EntranceTypeId
INNER JOIN dbo.fbStreetName AS fsn ON fsn.StreetNameID = fa.StreetNameId
--Notice the applied as AS and the positon of the AND |
|
|
Tue Jun 03, 2008 9:44 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Have you tried changing template for SELECT keyword? If not, please try it. Move ON keyword to the same line where you got JOIN; add more spaces before AND and a;lso before the following 3 lines.
Please make sure you modify the correct style - the one you actually use. Many people forget to select the style in the list as well as some forget to use the modified style assuming they made changes in the default style.
I also suggest to copy the default style into a new one. This way you can make any changes you want while playing with the formatting options and still have the default style intact. You can create as many different formatting styles as you want.
|
|
Tue Jun 03, 2008 9:58 am |
|
 |
citymail
Joined: 03 Jun 2008 Posts: 4 Country: Sweden |
|
|
|
Yes I've tried changing the template but I can't seem to get the AND postiioned underneath the ON since it depends on the length of joined table's name, is there anything I can do always position it underneath the ON?.
Also What about if I want an alias for the joined table how do make that change in the template?
 |
 |
SELECT ... AS ...
,... = ...
,(
...
)
FROM ... AS ...
,...
JOIN ... ON ...
AND ...,
(
...
)
WHERE ... = ...
AND ...
OR (
...
)
GROUP BY
...
,(
...
)
HAVING ...
,(
...
)
ORDER BY
...
,(
...
) |
|
|
Wed Jun 04, 2008 5:48 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7948
|
|
|
|
Sorry, the positioning cannot be variable. It is fixed and depends on the characters entered in the template and some other syntax dependencies.
Aliasing is not part of code formatting. Basically it has nothing to do with templates or code formatting. With default settings, aliases are generated automatically when code is typed, not when it is formatted. There is an option on "DB Options" tab that controls automatic insertion of aliases.
Hope this helps.
|
|
Wed Jun 04, 2008 9:21 am |
|
 |
citymail
Joined: 03 Jun 2008 Posts: 4 Country: Sweden |
|
|
|
Ok, thanx for great support!
|
|
Wed Jun 04, 2008 9:34 am |
|
 |
|
|
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
|
|
|