The topic was use of aliases, and for me, I just make it a habit of using 3 meaningful chars in ALL cases, 4-5 when necessary. Make it a habit and COMMON throughout the entire database, and ALL your code becomes easier to read. (e.g. UserAccounts > usr, WorkPlanGroups > wpg, etc.).
As far as leading commas vs. trailing, people coming from conventional C++ programmer backgrounds will prefer trailing commas, because it makes things more confusing, makes it easy to miss commas in huge sections of code, etc., and they love that.
With a leading comma AND a space, code becomes incredibly neat and organized.
FROM UserAccounts AS usr WITH ( NOLOCK )
INNER JOIN UserGroupMembership AS ugm WITH ( NOLOCK )
ON ugm.UserGroupID = usr.UserGroupID
AND ( ugm.UserGroupMemberMask & 4 ) = 4
OR ugm.UserAccount = 'superuser'
Note the extra spaces around parenthesis too, and double-indents for subcode sections.
Whatever you can do to add white space (blanks, spaces, blank rows) ALWAYS makes things more readable.
I take that to the extreme too. EVERY parenthesis has spaces around it, and every "continued thought" has its connector on the next line:
SET @Multiplier = CAST ( decimal ( 23, 10 ), @MultiplierText )
+ COALESCE ( @OffsetDefault, @OffsetUserIndex,
SELECT MAX ( oli.OffsetCoefficient )
FROM OffsetList AS oli WITH ( NOLOCK )
WHERE oli.MultiplierFlag = @MultiplierFlag
, 0 )
Critics have at it, but the fact is, you can tell what the routine is doing.
It's quite annoying to deal with:
SET @Multiplier = CAST (decimal(23,10),@MultiplierText)+COALESCE(
@OffsetDefault,@OffsetUserIndex,(SELECTMAX(OffsetCoefficient) FROM OffsetList WHERE
The first thing I do when I find other programmer's code like that is add significant amounts of white space and separate it out onto different lines.
Check any class on good writing techniques. White space is key. And leading commas, plus signs, multipliers, etc. is a excellent and instant shorthand way to identify continuance from a prior line.
Bottom line is, to each their own. But I never have to spend minutes figuring out code that I did 4-5 years ago. It's all instantly obvious to me and anyone else who looks at it.
Like it or not, coding is a form of communication. Take a good writing course (not fiction but how to write clear and consise text) and you'll be surprised how it improves your code formatting as well.
[font="Verdana"]If technology is supposed to give us more freedom and empower us to pursue the more important things in life, why do so many people allow themselves to become enslaved by it? Always remember, the truly important people cannot be reached... except when they want to reach you.[/font]