How to code in T-SQL