I don't like seeing abbreviations used when there's no need to have them. Abbreviations can be overused and many times they're cryptic. Worse, I often see them applied inconsistently.
In general, I try to avoid abbreviations unless they are on a tight list of ones that I use all the time.
A pet dislike of mine is seeing them used (even if consistently) for interval values in T-SQL functions like DATEADD, DATEDIFF, etc.
In the list above, please use the name of the interval rather than the abbreviation. Don't have people wondering if:
1 |
DATEADD(w, 2, SYSDATETIME()) |
means "week" or "weekday", or if "m" means "minute" or "millisecond".
If you mean "week", just write this:
1 |
DATEADD(week, 2, SYSDATETIME()) |
And if you mean "weekday", just write this:
1 |
DATEADD(weekday, 2, SYSDATETIME()) |
At least you'll remove all doubt about what you meant.
Make your code easy to read and understand.
I agree! Just to emphasise the confusion that it can cause, even the great Greg Low made a mistake here. "w" is "weekday" so the example should be "DATEADD(weekday, 2, SYSDATETIME())"
🙂
HI Dave, I wasn't meaning the two to be equivalent. Each was a separate example. But can see it could be read that way. I've clarified it. Thanks.