我在使用下面的查詢從SQL Server表中提取記錄時,在SQL查詢中使用DISTINCT
。DISTINCT關鍵字不能在SQL服務器中使用圖像數據類型
SELECT DISTINCT firstname, lastname, profileImage
from employee
凡profileImage
是在我的表image
數據類型。
問題:
當我試圖從我的查詢中使用DISTINCT
表中提取的數據給出了下面的錯誤。
Msg 421, Level 16, State 1, Line 1 The image data type cannot be selected as DISTINCT because it is not comparable.
當我從我的查詢中刪除DISTINCT
關鍵字它工作正常。
爲什麼會發生這種情況?
自從近10年前發佈的產品** 2005 **版以來,以下通知已應用於[documentation](http://msdn.microsoft.com/zh-CN/library/) ms187993(v = sql.90).aspx):「將在未來版本的Microsoft SQL Server中刪除ntext,text和image數據類型。避免在新開發工作中使用這些數據類型,並計劃修改當前使用它們「 – 2014-10-29 11:30:43
@Chris - 我瞭解錯誤消息,但我正在尋找另一種方法來實現此目的。因爲我試圖將'profileImage'字段轉換爲'varchar',但它也失敗:( – prog1011 2014-10-29 11:31:07
轉換爲'VARBINARY' – 2014-10-29 11:33:19