To convert integer to date values such as 09122020, split the number into day, month and year and build the date from the parts. This post compares four methods on tested data, shows why a lost leading zero and the session language break two of them, and times them on a million rows.
SQL SERVER – Capturing INSERT Timestamp in Table
A default can insert timestamp values when the caller omits a datetime column. I use a session-local CURRENT_TIMESTAMP example.
SET STATISTICS TIME ON – SQL in Sixty Seconds 139
Do you know how long your query took to execution? Well, let us learn that today in SQL in Sixty Seconds. We will discuss SET STATISTICS TIME ON.
Day Name From Date in SQL Server: DATENAME, FORMAT and More
Finding the day name from date values takes one function, but three methods exist, and they differ on language and speed. This post compares DATENAME, FORMAT and a formula that ignores language and DATEFIRST. It measures all three on a million rows and shows how the session language changes the result.
How to Combine Time and Date in SQL SERVER? – Interview Question of the Week #285
Question: How to Combine Time and Date in SQL SERVER?
Answer: A very simple and popular question. Let us learn together.
Year-Over-Year Comparisons in One Query
Build year-over-year monthly comparisons with a complete calendar, LAG, date-aligned joins, safe percentages, and missing-period rules.
A Daily Streak in SQL: Finding the Longest Run of Consecutive Days
Find consecutive days with gaps and islands, rank the longest streak per user, and define a current streak using the right business date.







