Checking Type mismatch in Recursive CTE – Collation at fault

Took me a while to figure out why there was a type mismatch in a CTE I was writing for in a query the other day, always think about collation, because although it’s in the background for most of the time it can always crop up when you least expect it!

http://consultingblogs.emc.com/paulmcmillan/archive/2011/01/07/sql-collation-gotcha-1-recursive-cte.aspx