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.
SQL SERVER – 2005 – List All Stored Procedure Modified in Last N Days
A query on sys.objects to list every stored procedure modified in last N days, or ones created lately. I use 7 days; change it to what you need.
Current Date and Time in SQL Server: GETDATE, SYSDATETIME and More
You can read the current date and time in SQL Server in eight ways, and they differ in precision and time zone. This post runs them side by side, shows that each one is evaluated once per statement, and picks the right one for defaults, audit columns and reports.
SQL SERVER – Delay Function – WAITFOR clause – Delay Execution of Commands
The WAITFOR clause delays a batch, stored procedure or transaction until a set time or for an interval. I use it daily after restores. DELAY and TIME examples.
SQL SERVER – Retrieve – Select Only Date Part From DateTime – Best Practice
Selecting the date part and formatting it are different tasks. I keep typed dates for calculations and text for display.
SQL SERVER – UDF – Function to Display Current Week Date and Day – Weekly Calendar
A script and UDF that show each current week date with its day, from Sunday to Saturday, using DATEPART and DATEADD. Handy for a weekly calendar report.
SQL SERVER – Script/Function to Find Last Day of Month
A one line DATEADD query to find the last day of month for any date. It handles leap years: February 2008 gives the 29th and 2007 the 28th.







