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?

One thought on “T-SQL Binary Weirdness”

Leave a Reply

Your email address will not be published. Required fields are marked *