Some practical tips against traps in T-SQL
1. Value can be truncated by ISNULL()
2. Transaction roll back doesn’t affect local variables including table variables
https://www.brentozar.com/archive/2020/08/half-of-you-dont-understand-variables-and-transactions/
3. Cursor may deadloop with CONTINUE
4. NULL fails arithmetic comparisons
5. How to choose columns on conditions