查找数据库表中重复的 Image 类型值
直接上代码:
SELECT * FROM [dbo].[V_Courseware] WHERE HASHBYTES('MD5', CAST([Thumbnail] AS VARBINARY(4096))) IN (SELECT HASHBYTES('MD5', CAST([Thumbnail] AS VARBINARY(4096))) FROM [dbo].[V_Courseware] GROUP BY HASHBYTES('MD5', CAST([Thumbnail] AS VARBINARY(4096))) HAVING COUNT(*) > 1);
替换以上代码中相应对象即可,注意其中“4096”的最大值为“8,000”,值越大精确度越高,但速度越慢。