1.二进制转为字符串 ALTER function varbin2hexstr( ) )) as begin ),@i int select @re='',@i=datalength(@bin) ),) ),) +@re , -- return('0x'+@re) return @re end 2.字符串转为二进制 CREATE function [dbo].[hexstr2varbin]( ) )) as begin ), ), ), @getint int, @n int, @totalin