在 SSRS 矩阵中显示 Hashbytes 值

Displaying Hashbytes value in SSRS matrix

我有一个简单的查询,试图在 SSRS 矩阵中显示 hashbytes 值 - 这会在呈现矩阵时引发错误

我的查询

    select  hashbytes('md5',Consultant_Code) as Consultant_Code, 
    hashbytes('md5',Surgeon1_Code) as Surgeon_Code
    from TheatreOps

当它在预览视图中呈现时,它会在我希望看到该值的地方显示#Error,有没有人以前有过这个问题,也许可以提出修复建议?

SSRS 处理返回的数据类型 (varbinary) 可能是问题所在。

尝试:

select  cast(hashbytes('md5',Consultant_Code) as varchar) as Consultant_Code, 
        cast(hashbytes('md5',Surgeon1_Code) as varchar) as Surgeon_Code
from TheatreOps

使用以下内容

SELECT 
'0x' + CONVERT(NVARCHAR(32),HashBytes('MD5', Consultant_Code),2) as Consultant_Code,
'0x' + CONVERT(NVARCHAR(32),HashBytes('MD5', Surgeon_Code),2) as Surgeon_Code,
FROM TheatreOps