Maison  >  Article  >  base de données  >  .SQL Server中 image类型数据的比较

.SQL Server中 image类型数据的比较

WBOY
WBOYoriginal
2016-06-07 17:43:361953parcourir

在SQL Server中如果你对text、ntext或者image数据类型的数据进行比较。将会提示: 不能比较或排序 text、ntext 和 image 数据类型,除非使用 IS NULL 或 LIKE 运算符。 不过image也是不支持like比较的。 那怎么样对数据库中的图片做比较呢。 对于这种大型对象

在SQL Server中如果你对text、ntext或者image数据类型的数据进行比较。将会提示:不能比较或排序 text、ntext 和 image 数据类型,除非使用 IS NULL 或 LIKE 运算符。不过image也是不支持like比较的。
那怎么样对数据库中的图片做比较呢。
对于这种大型对象的处理,虚拟主机,在Oracle中有有专门的函数DBMS_LOB.COMPARE,香港服务器,而SQLSERVER中没有专门的处理函数,虚拟主机,
只能通过使用substring函数一段一段的从image数据中截取放到varbinary类型数据,最长8060字节(8k),
然后再对varbinary类型数据进行比较。以下是一个比较image的函数例子:

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Article précédent:filter indexsArticle suivant:所有行业分类sql,带查找索引