Reproduce a conversion error that survives a WHERE filter, inspect optimizer choices, and replace fragile casts with TRY_CONVERT or proper types.
SUM ROWS Versus RANGE: Ties Change a Running Total
SUM ROWS versus RANGE defines different running positions. Keep tie-breaking and peer grouping explicit when comparing the resulting totals.
CAST Without a Length: The Default Can Truncate Text
CAST Without a Length can silently choose a target width that is too short for the source text. I compare omitted and explicit lengths. The same conversion syntax can look harmless while losing the end of a string.
STDEV and STDEVP: Choose Sample or Population
STDEV and STDEVP report spread in the input’s units. Compare a sample, a full population, duplicates, NULL and a single observed value.
SQL SERVER – Difference Between Candidate Keys and Primary Key
What is the difference between a candidate key and a primary key? A table can have many candidate keys, but only one of them becomes the primary key.
APPROX_COUNT_DISTINCT in SQL Server: Saves Memory, Not Time
APPROX_COUNT_DISTINCT counts distinct values with almost no memory. Tested on 5 million rows, it was within 2.2 percent of the exact count and needed no memory grant, while COUNT(DISTINCT) asked for 436 MB. It was not faster.
SQL SERVER – Find Hostname and Current Logged In User Name
Connected to many servers in SSMS? HOST_NAME() and SUSER_NAME() show the hostname and current logged in user for any query window.






