Interview Question of the Week #047 – Logic To Find Weekdays Between Two Dates

I often enjoy seeing interview questions where the contestant has to write SQL Scripts. Here is another such example. Question: How to find weekdays between two dates? Answer: Here is a function which can be used to find weekdays between two dates. CREATE FUNCTION dbo.getDayCount(@startdate date, @enddate date) RETURNS INT…
Read More

SQL SERVER – Availability Group and the Six Critical Steps for DBAs to Follow – Notes from the Field #104

Mike’s, “now what am I supposed to do?”, face. [Note from Pinal]: In this episode of the Notes from the Field series database expert Mike Lawell explains about Availability Group and the Six Critical Steps for DBAs to Follow.  A few weeks ago, I asked questions in conferance, how many people…
Read More

Interview Question of the Week #046 – How @@DATEFIRST and SET DATEFIRST Are Related?

Question: How @@DATEFIRST and SET DATEFIRST are related? Answer: The master database’s syslanguages table has a DateFirst column that defines the first day of the week for a particular language. SQL Server with US English as default language, SQL Server sets DATEFIRST to 7 (Sunday) by default. We can reset any day…
Read More