I want to cast a varchar(max) to varbinary(max) and get the results with the hex numbers. I am doing "SELECT cast(Content as varchar(max)) FROM [dbo].[employeetable] where Id = 216" It gives me the correct value ="504B030414000600080000002100C7AF3C0FA10" but i want "0x504B030414000600080000002100C7AF3C0FA10" so I need the hex value '0x' in front.