write t-sql code to find the last work day of the month
- User
write t-sql code to find the last work day of the month
Assistant
Here is an example T-SQL code to find the last work day of the month:
SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, DATEADD(MONTH, -1, GETDATE())), GETDATE()) AS LastWorkDayOfMonthThis code uses the
DATEADDandDATEDIFFfunctions to calculate the last day of the month by adding one month to the current date and subtracting one month from the previous date. The result is then returned as theLastWorkDayOfMonthcolumn.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.