INF: Cannot SELECT DISTINCT * on a Table w/ Text/Image Column (162032)



The information in this article applies to:

  • Microsoft SQL Server 6.5
  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q162032

SUMMARY

SQL Server 6.5 no longer allows a 'SELECT DISTINCT * FROM <table>' if that table has a text/image column. If you attempting to perform such a query, you will receive the following error message:
Msg 8163: Text/Image datatype cannot be selected as DISTINCT.

Earlier versions of SQL Server treated this as a valid query if the table contained a unique index or primary key, whose existence would guarantee that the row was distinct. In the presence of such an index, the following message would have been raised:
Msg 421: TEXT and IMAGE datatypes may not be selected as DISTINCT.
SQL Server has never allowed a DISTINCT operation on an individual text
or image column.

Modification Type:MinorLast Reviewed:3/1/2005
Keywords:kbusage KB162032