当我执行这个硬编码,我得到正确的结果:
Declare @result nvarchar(32)
Set @result = convert(varchar(32), hashbytes('MD5', '1' + 'One' + 'Two' + 'Three'), 2)
select @result
结果:4173AB4C6EE66BC1FF7B7E5D44A872CA(正确)
但是,当我打电话/执行此存储过程,给它相同的参数,这是一个不同的结果
ALTER Procedure [db_owner].[CheckTheTransaction]
@DataID nvarchar(50),
@Data1 nvarchar(50),
@Data2 nvarchar(50),
@Data3 nvarchar(50)
as
Declare @result nvarchar(32)
Set @result = convert(varchar(32), hashbytes('MD5', @DataID + @Data1 + @Data2 + @Data3), 2)
Select @result
我执行:
DECLARE @result int
EXEC @result = [db_owner].[CheckTheTransaction]
@DataID = '1',
@Data1 = 'One',
@Data2 = 'Two',
@Data3 = 'Three'
SELECT 'Result' = @result
GO
结果:5BD42777932EE959AD5A4C9FEE142F00(错)
我哪里做错了?