如何将HASHBYTES返回值转换为GUID?
这是我到目前为止所做的。
CREATE PROCEDURE [dbo].[Login]
@email nvarchar,
@password varchar
AS
BEGIN
DECLARE @passHashBinary varbinary;
DECLARE @newPassHashBinary varbinary;
-- Create a unicode (utf-16) password
Declare @unicodePassword nvarchar;
Set @unicodePassword = CAST(@password as nvarchar);
SET @passHashBinary = HASHBYTES('md5', @password);
SET @newPassHashBinary = HASHBYTES('md5', @unicodePassword);
答案 0 :(得分:7)
简单地施展它:
select cast(hashbytes('md5','foo') as uniqueidentifier)
但是有两个问题挥之不去:
BINARY(16)