I have the statements:
declare @x varchar(10)
declare @cardnum bigint
set @cardNum=9999999999
set @x=convert(varchar, CONVERT (varbinary(8), CONVERT(BIGINT, @cardNum)))
print @x
I an getting the answer as Tãÿ
not getting Hex value 2540BE3FF
as string
Try it like this:
Read more about it on this MSDN link