SQL Server: 将 16进制 转成字符串及根据GUID产生bigint

--通用的做法
select sys.fn_varbintohexstr(0x02000000DD6BE318DC3B2B260AA9923FE133FB046EA0EEE10000000000000000000000000000000000000000)

--适合2014,不适合2005
SELECT '0x'+CONVERT(VARCHAR(MAX),0x02000000DD6BE318DC3B2B260AA9923FE133FB046EA0EEE10000000000000000000000000000000000000000,2)


--根据guid产生bigint
select CONVERT(bigint, CONVERT(varbinary, CAST(N'0x' + replace(newid(),'-','') AS char),1))


你可能感兴趣的:(SQL,Server)