This Alternate to AGENT_DATETIME converts integer date and time values without calling an msdb function. I preserve leading zeros in the time.
SQL SERVER – SQL Audit Date Time Does Not Match Machine Date Time – Solution
A bank DBA noticed SQL Audit log times did not match the server clock. Here is why the audit time looks off and how to see it in local time.
SQL SERVER – Powershell Script – Remove Old SQL Database Backup Files from Azure Storage
My backups to Azure kept piling up. Here is the PowerShell script I wrote to remove old SQL database backup files from Azure Storage automatically.
SQL SERVER Puzzle – Conversion with Date Data Types
Converting values with CAST can round in ways you don’t expect. A puzzle on Date Data Types: guess the output of each query before you run it.
SQL SERVER – System Function @@IDLE to Find System Ideal Time
Running @@IDLE returns a number that is hard to read. Here is what this system function measures and how to turn it into idle time you can understand.
How to Introduce Time Delay Between Two T-SQL Commands? – Interview Question of the Week #091
How do you introduce a Time Delay between two T-SQL commands? An interview question developers ask often, answered with WAITFOR DELAY.
Change in Date Format: Why LEFT Turns GETDATE Into Text
A change in date format shows up when you apply LEFT to GETDATE: the date goes from year first to month name first. This puzzle explains the implicit conversion behind it, how language settings change the text, and how to get the date you want on purpose.




