这个商店程序的问题在哪里? [英] Where is the problem to this store procedure?

查看:94
本文介绍了这个商店程序的问题在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



有人能告诉我这个商店的程序有什么不对吗?



Hi guys

Can anyone tell me where is the wrong in this store procedure?

CREATE PROCEDURE [dbo].[Open_pdf]
    @ID int,
    @doc image
AS
BEGIN
    SELECT Docu.ID FROM Docu INNER JOIN docs on Docu.ID=docs.docu_id
    WHERE Docu.ID=@ID and docs.doc=@doc
END





它给了我这个错误



消息402,等级16,状态1,程序Open_pdf,第12行

数据类型图像和图像在等于运算符中不兼容。



提前致谢



It gives me that error

Msg 402, Level 16, State 1, Procedure Open_pdf, Line 12
The data types image and image are incompatible in the equal to operator.

Thanks in advance

推荐答案

在WHERE条件中,您要比较
In the WHERE Condition you are comparing
docs.doc=@doc

这是数据类型图像。 MS SQL Server中不允许这样做。删除此条件,SP将工作

which is of data type image. This is not allowed in MS SQL Server. Remove this condition and the SP will work


Quote:

由于Image数据类型是二进制的用于存储数据的巨大空间,IMO,比较图像字段的最简单方法是哈希比较。所以你需要在你的桌子上存储Photo列的哈希值。

Since the Image data type is a binary and huge space for storing data, IMO, the easiest way to compare Image fields is hash comparison. So you need to store hash of the Photo column on your table.





欲了解更多信息,请查看:



比较SQL中的图像



我希望这会对你有所帮助。



For more info check this:

Compare Images in SQL

I hope this will help to you.


这篇关于这个商店程序的问题在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆