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.
CHECKSUM: A Matching Result Does Not Prove Text Identity
CHECKSUM matches do not establish unchanged text. Preserve complete values and compare hyphen and trailing-space differences explicitly.
SQL SERVER – Validate Field For DATE datatype using function ISDATE()
A CSV import crashed on the date 30/2/2007. Use the ISDATE() function to validate a VARCHAR column in a staging table before moving rows to a DATETIME field.
TRY_CONVERT Integer Validation: Check the Target Type
TRY_CONVERT integer validation starts with the destination type and a separate input policy. This example compares blank, signed, decimal and overflowing text without writing data.







