I just had an interesting occurance.
Server Version:10.0, 64-bit
Database Compatibility: 80
the snippet in the question copied verbatim into SSMS and worked. The result was 255.
I would have thought database compatibility mode would have prevented this...