Calculating number of workdays between 2 dates
Today I saw someone asked a question in MSDN t-sql forums “How to calculate the number of working days between two given dates”. I found this very interesting, since we can solve this problem by using...
View ArticleCalculating Nth weekday in a month
How to calculate the Nth week day of a month? This will be useful in most of the Scheduling problems like Scheduling Jobs, Appointments etc. Let me demonstrate how we can achieve this: Let us take an...
View ArticlePerformance implications using NewID() in Random order
Today, I came across a question in MSDN forums “How to pick 5 random records?”. In SQL Server the only consistent way I know is to use NEWID() function in the Order By Clause. select top 5 * from...
View ArticleWhat exactly is Fragment_count?
I started to think about this problem, when I saw this question asked by Sankar Reddy in SQL Server Quiz 2010. I have a fair bit of idea about Index fragmentation and defragmentation. I checked...
View Article