Find the last day of any month with DATEADD and DATEDIFF. One script returns the last day of the previous, current and next month in SQL Server.
GROUP BY Done Right
GROUP BY Done Right separates row filters from group filters, handles NULL groups, and avoids totals inflated by careless joins.
SQL SERVER – UDF – Validate Integer Function
ISNUMERIC() returns 1 for plus, minus and currency signs, so it is not a safe check. I share the UDF I use to validate integer values instead.
SQL SERVER – UDF – Function to Get Previous And Next Work Day – Exclude Saturday and Sunday
Inspired by a ColdFusion post by Ben Nadel, here is the UDF I use to get the previous or Next Work Day for any date, skipping Saturday and Sunday.
SQL SERVER – UDF – Get the Day of the Week Function
Get the day of the week as a name in SQL Server: a UDF using DATEPART with CASE, plus the simpler DATENAME(dw, GETDATE()) a reader suggested.
SQL SERVER – SPACE Function Example
Does SQL Server have a SPACE function? Yes. SELECT SPACE(100) returns 100 spaces, and a short example uses it to join last and first names.
SQL SERVER – CASE Statement in ORDER BY Clause – ORDER BY using Variable
Stop building ORDER BY strings and running them with EXEC in a stored procedure. I show how a CASE statement in ORDER BY sorts by a variable without dynamic SQL.







