GETUTCDATE () - returns the date and time of the machine the SQL Server is running on as UTC. GETDATE () - returns the date and time of the machine the SQL Server is running on. The output of this calculation is stored in the variable, as shown in Script 3. SQL Server Lesser Precision Data and Time Functions have a scale of 3 and are: CURRENTTIMESTAMP - returns the date and time of the machine the SQL Server is running on. In this step, we use the DAY interval within the DATEDIFF function to determine the number of days between two dates. Step 1: Calculate the total number of days between a date range In this approach, we employ several steps that make use of DATEDIFF and DATEPART functions to successfully determine working days. In this article, we take a look at some of the tricks and T-SQL methods that can be used to easily create a user-defined function that calculates working days and hours. I have personally noticed a need for such a function in cases whereby some KPIs relates to determining a total number of days/time it takes to resolve a customer complaint. One such common user-defined function involves the ability to calculate the total number of working days and working hours within a given date range. That is why – as developers – we are given an ability to create our own user-defined functions. Unfortunately, it is impossible for SQL Server to provide built-in functions for everything that developers would need. We can better understand this configuration and also as SQL Server work day of the week (by default), showing in the calendar below the 'work day' used to demo (Wednesday, ) and 'off day work' (Saturday, and Sunday, ).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |