Viewing 15 posts - 1 through 15 (of 29 total)
A great way to "clean up" the query is the use of the GROUPING() function to remove the NULLs. It can also be used to have better control on ordering...
September 6, 2018 at 5:13 am
I think one of the most powerful uses of a calendar table is joining with the calendar to avoid cursors. I've seen far too many RBAR cursors...
December 4, 2017 at 6:19 am
The only thing I don't like is your use of COALESCE. If there happens to be a NULL department (as the result of a left join), then...
December 4, 2017 at 6:13 am
The correlated subquery may be executed many times. It will be run once for each candidate row selected in the outer query.
I believe that Jeff Moden refers to this as...
March 6, 2014 at 5:56 am
The solution seems to be to calculate the days for comparison purposes. Then, add the days to a standard reference date, such as 1900-01-01. THEN do your DATEDIFF calculations. That...
January 16, 2014 at 10:14 am
Calculations are done using a calendar year.
For example if person A was born October 16, 1995, and we want to figure out how old he/she was on January 15, 2014,...
January 16, 2014 at 8:46 am
Do you have a good query for formatting duration (or age) in Years, Months, Days?
So often in my world, I am asked to find out who was the...
January 16, 2014 at 6:14 am
There are two things that I prefer to do in a different way:
The first is your use of ISNULL(FieldName, 'ZTotal') -- I prefer to use a case statement
CASE GROUPING(FieldName) WHEN...
November 16, 2012 at 5:33 am
I've seen this on SQL Server Central before, so I squirreled away the code where I could always find it when needed. I typically use it in a stored...
November 2, 2012 at 5:46 am
Don't forget to flip the flag -- EvaluateAsExpression to True!!!! Otherwise it will just ignore that beautiful expression you just composed and go about its merry way using the...
October 20, 2011 at 9:55 am
When there were three of us working together, I used to have a lot self-directed time. Since I don't suffer from motivation issues, I could spend a lot of...
May 13, 2011 at 6:31 am
djackson 22568 (4/11/2011)
My vehicle has automatic lights - I never use them. I, imagine this, actually know where the switch is and use it when appropriate.
It's not quite the...
April 11, 2011 at 8:44 am
Maybe Electric Dreams[/url] will become a reality. Hey, it was made in 1984.
April 11, 2011 at 8:38 am
Obviously my first post was just in jest.
While peer review isn't really a true measurement because it's subjective (like judges in the Olympics -- yecch), it is a...
February 21, 2011 at 6:39 am
WTFs/minute sounds like a good measurement. Exceptional code can be measured in days between WTFs, really good code can be measured in WTFs/hour and really poor code in WTFs/second.
February 21, 2011 at 6:13 am