Binary to Bigint Sample
Posted: March 27, 2017 Filed under: Uncategorized Leave a commentDeclare @bStr varchar(16)='09EEDF7C10C41030' Select Convert(BIGINT,0x09EEDF7C10C41030) --715755114748710960 --Use CONVERT function with style 2 to data type BIGINT Select Convert(bigint, CONVERT(VARBINARY(8), @bStr,2)) --check Select CONVERT(BINARY(8), CONVERT(BIGINT, 715755114748710960)) --0x09EEDF7C10C41030 --Below returns wrong value Select Cast('0x'+@bStr as binary(8)) ---wrong
Advertisements