PHXHoward (7/12/2011)
Why do these give me different results? 0x80 has an even number of characters.
select CONVERT (bigint, convert(VARBINARY(20),'0x80') ,1)
select CONVERT (bigint, 0x80 ,1)
You're asking different questions. In the first one '0x80' is a string, see demo below:
SELECT CONVERT (BIGINT, CONVERT(VARBINARY(20), '0x80', 1), 1) -- string
SELECT CONVERT (BIGINT, CONVERT(VARBINARY(20), 0x80), 1) -- binary
SELECT CONVERT (BIGINT, 0x80, 1) -- the other one