Home  >  Article  >  Database  >  .SQL Server中 image类型数据的比较

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

WBOY
WBOYOriginal
2016-06-07 17:43:361953browse

在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的函数例子:

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn