Tejas Shah’s easy script to list the date of all weekdays or weekends of a year with a recursive CTE, first written to find every Sunday of 2010.
SQL SERVER – Difference Temp Table and Table Variable – Effect of Transaction
Temp table versus table variable, part two: a transaction rollback undoes changes to a temp table, but a table variable keeps its values.
Prefix Searches: LIKE, LEFT and CHARINDEX
LIKE, LEFT and CHARINDEX can match the same prefix through different access paths. Compare complete matching rows and measured plans, then test literal wildcard characters and collation before choosing a search expression.
SQL SERVER – ORDER BY Clause and TOP WITH TIES
How does TOP WITH TIES work with ORDER BY? A simple example shows how WITH TIES returns the extra rows that match the value of the last row.
SQL SERVER – Comma Separated Values (CSV) from Table Column – Part 2
Comma Separated Values from a table column, part 2: SUBSTRING limits the XML length, so I rewrote the query with STUFF and FOR XML PATH to remove it.
XML exist: A Present Boolean Expression Still Exists
XML exist tests a nonempty XQuery result. Even false() returns a value, so use a node predicate to test presence and preserve NULL XML input.







