T-SQL

JSON Data Type Is Not Comparable!

I was really not happy when I hit this with the new JSON data type. In SQL Server, set operators like UNION, INTERSECT, and EXCEPT have been a very reliable part of many generic scripts. We already survived older non-comparable types like text and image, and things became much cleaner…

Read more
T-SQL

SET vs SELECT Variable Assignment When No Rows Match

This one can be easy to miss, but it can change your logic in a silent way. SET and SELECT look similar when assigning a variable, but they do not behave the same in all cases. The difference appears when the subquery returns no rows. With SELECT @var = …the…
T-SQL

SQL Server Allows Empty Stored Procedures

I found one small SQL Server behavior that surprised me more than I expected. You can create a stored procedure with an empty body, and SQL Server will accept it. No SELECT, no INSERT, no PRINT, nothing inside. Even more surprisingly, the procedure can be executed without any error. I…
SQL Server

SQL Server 2025 vs 2022: What Changed in DMVs

I recently compared SQL Server system DMVs between SQL Server 2022 (16.0.4225.2) and SQL Server 2025 (17.0.1000.7). I used Redgate SQL Compare to generate an HTML report, and in this post, I’m providing a summary of the changes made, including additions, deletions, and modifications. See the full comparison: SQL_2022_To_2025_DMV_Comparison How…

Read more
T-SQL

SUBSTRING() in SQL Server 2022 vs 2025: Optional LENGTH Is Finally Here

SUBSTRING() is one of those T-SQL functions we all use constantly: parsing identifiers, trimming prefixes, extracting parts of file paths, URLs, error messages, or just cleaning up data for reporting. Until now, SQL Server forced us to always provide the third argument (length). With SQL Server 2025, Microsoft added a…
SQL Server

SQL Server 2025: Web Edition Is Gone

As a SQL Server DBA, I usually don’t panic about licensing changes — but the removal of SQL Server Web Edition in SQL Server 2025 is one of those changes that immediately hit a real production project I’m responsible for.Web Edition has been the quiet workhorse for years: small web…
T-SQL

Managing String Content in View Definitions

The hidden text (this_is_hidden_text_in_the_view) in the view definition is an intriguing addition. Anything after the SELECT * FROM sys.tables query that is not a valid SQL statement (like a comment or plain text) will not be executed or parsed by SQL Server. It essentially becomes invisible to the engine and…
SQL Server

SET STATISTICS PROFILE

SQL Server provides various tools and commands to help database administrators and developers analyze and optimize query performance. One of these commands is SET STATISTICS PROFILE. This command is particularly useful for obtaining a detailed execution plan along with the runtime statistics of a query, which can be invaluable for…

Read more