A quick Monday puzzle: what happens when you REPLICATE over 8000 characters into a VARCHAR(MAX) variable? Guess the lengths before you run it.
CONCAT_NULL_YIELDS_NULL and CONCAT: How NULL Behaves in Strings
The CONCAT_NULL_YIELDS_NULL setting decides whether a string plus NULL returns NULL. The CONCAT function never looks at it and treats NULL as an empty string. This post tests both on a customer table, shows the errors the OFF setting causes, and gives safe patterns for names and numbers.
Weekday Logic That Works Under Any DATEFIRST Setting
Make weekday logic independent of DATEFIRST with a normalized offset or a known Monday, then test every date in a full year.
CROSS APPLY and OUTER APPLY in Everyday Queries
Use CROSS APPLY and OUTER APPLY for per-row functions, reusable expressions, VALUES unpivoting, DMV text, plans, and latest rows.
geometry STArea: Measure the Polygon Interior
geometry STArea measures polygon interior rather than its outline. These local planar shapes show equal areas with different perimeters, a hole subtraction and zero-area instances.
SQL SERVER – Avoid Using Function in WHERE Clause – Scan to Seek
Does a function in WHERE clause really hurt performance? Using AdventureWorks and STATISTICS IO, I show what happens and how to turn a scan into a seek.
SQL SERVER – Check If String is a Palindrome in Using T-SQL Script – Reverse Function
A friend building a captcha had to skip words that read the same backward. Here is a T-SQL script with REVERSE to check if a string is a Palindrome.





