A quick example of the datetime function TODATETIMEOFFSET in SQL Server, and how it differs from SWITCHOFFSET when offsets change.
Row Goals: Why TOP and EXISTS Change the Plan
Inspect row goals from TOP and EXISTS, read EstimateRowsWithoutRowGoal, and compare a targeted optimizer hint using actual plans.
Unsigned Integers: Safe Type and Range Mapping
Map unsigned integers to SQL Server types without narrowing their range. Keep strict source-text validation separate from destination CHECK constraints.
SQL Server: Why INSERT OUTPUT Does Not Prove a Commit
INSERT OUTPUT can return an identifier before a transaction commits. These tested examples show a rollback after a returned row and a pattern that returns results after commit.
SUBSTRING Binary: Count Bytes Rather Than Characters
SUBSTRING binary offsets use byte units. Keep text slicing separate from encoded payload slicing and retain empty and missing cases.
SQL SERVER – Default Statistics on Column – Automatic Statistics on Column
Does a column need an index to have statistics? No. A quick demo shows automatic statistics on column data when AUTO_CREATE_STATISTICS is on.
Count Distinct Pairs: Keep the Columns Together
Count distinct pairs by keeping their columns together. A small T-SQL example shows why concatenated labels can collide. Choose whether incomplete pairs belong in the count.






