More T-SQL Weirdness

Erland Sommarskog pointed the following out to me: SELECT 5ee I wouldn’t have thought that was at all valid. I found heaps more like: SELECT 0xBEG SELECT 0xFEZ SELECT 5.G SELECT 0xET                (phone home) Interesting parsing. I would have just dismissed these all as invalid syntax without ever trying them.  

T-SQL Binary Weirdness

It’s always a good day when you learn something new. Steve Kass taught me something new about T-SQL today. If you execute the following: SELECT 2 + 3 the value returned is 5. However, if you execute: SELECT 0x2 + 0x3 the value returned is 0x0203. Am I the only one who finds that bizarre?

A Design Pattern For Nested Triggers?

Ever since sql server 2000 appeared, we’ve had the ability to create multiple triggers on a single table. Until a problem I saw at a site the other day though, I’d never REALLY stopped and thought about the consequences of using multiple update triggers. In this case, one dev had added a trigger to maintain a denormalised table like so: CREATE TRIGGER TR_MyTable_FullName_Update ON MyTable FOR UPDATE AS UPDATE MyTable SET FullName = FirstName + ‘ ‘ + LastName FROM MyTable INNER JOIN Inserted ON MyTable.MyTableKey = Inserted.MyTableKey Apart from the issues with assuming name order, etc. and the fact … Continue reading A Design Pattern For Nested Triggers?