There is an older book available from Redgate called The Guide to SQL Server Team Development[/url]. It's free to download. It has a chapter on coding standards. The rest of the book is somewhat out of date.
The main point is clarity. Consistent aliases is one. For example, this should not be done:
SELECT ...
FROM SomeTable a
JOIN SomeOtherTable b
ON a.id=b.id
JOIN YetAnotherTable c
ON b.id = c.id
WHERE...;
SELECT ...
FROM DifferentTable a
JOIN NotTheSameTable b
ON a.id = b.id
WHERE...;
You're using the same aliases for different tables. In a really tiny query like this, no big deal. In a larger query it makes everything harder to read and understand. Clarity is key. Something like this:
SELECT ...
FROM SomeTable AS st
JOIN SomeOtherTable AS sot
ON st.id=sot.id
JOIN YetAnotherTable AS yat
ON sot.id = yat.id
WHERE...;
SELECT ...
FROM DifferentTable AS dt
JOIN NotTheSameTable AS ntst
ON dt.id = ntst.id
WHERE...;
Every time you reference a table, use the same alias. That consistency will make all your code more readable. I also break they queries vertically as you can see. I use the AS keyword to mark aliases because it makes the code more clear. I always terminate each statement with a semi-colon since more and more that's a requirement within SQL Server.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning