To find the current language of a SQL Server session, read @@LANGUAGE or @@LANGID, or query sys.dm_exec_sessions. This post tests each one, switches the session to German and British, and shows how the language changes month names and how text turns into dates.
Find the Data Type of an Expression in SQL Server
To find the data type of an expression in SQL Server, pass it to SQL_VARIANT_PROPERTY or describe the whole query with sys.dm_exec_describe_first_result_set. This post tests both on a percentage calculation, shows how precision and scale come out, and explains why 2147483647 plus 1 fails.
Finding Free Time Slots in a Calendar With GENERATE_SERIES
Find free time slots with GENERATE_SERIES, exclude overlapping bookings, and merge busy intervals before calculating calendar gaps.
SQL SERVER – Measuring the Length of VARCHAR and NVARCHAR Columns with COL_LENGTH
Does an NVARCHAR column take twice the space of VARCHAR? Yes. I measure the length of VARCHAR and NVARCHAR columns with COL_LENGTH to show it.
IIF in SQL Server: IF THEN Logic Compared With CASE
IIF in SQL Server is a short way to write IF THEN logic with two outcomes. This post compares it with CASE in a small juice shop table, shows that both produce the same plan, and covers NULL, data types and the WHERE clause.
Multi-Statement Table-Valued Functions and Interleaved Execution
See how interleaved execution corrects estimates for multi-statement table-valued functions and when an inline rewrite wins.
How to Trim TIME Part in DATETIME Values? – Interview Question of the Week #200
How to trim TIME part in DATETIME values? A reader wanted to keep only the date and the hour, so here are ways to cut off the minutes and seconds.







