This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

SQL Server Exception  RSS feed

 
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using follwoing query

SELECT Fax.* FROM Fax
INNER JOIN FaxAccess ON Fax.DocumentNumber = FaxAccess.DocumentNumber
WHERE FaxTypeId = 2 AND isPublic = 0 AND
(FaxAccess.UserAccess LIKE '\Seattle\Police\Detective%' )

UNION

SELECT Fax.* FROM FAX
WHERE FaxTypeId = 2 AND
Fax.isPublic = 1

and both queries return same columns independently but I get following error when I execute the queries with union

Server: Msg 8163, Level 16, State 4, Line 1
The text, ntext, or image data type cannot be selected as DISTINCT.

I would appreciate if someone can help me out. By my question you can guess I am a novice.
 
Muhammad Imad Qureshi
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am found the solution. In one of my column I had an image file.
and because I have one image file in one of my columns that I am selecting
thats why I should do UNION ALL because The UNION operator by default
eliminates duplicate rows from the resultset. The duplicate eliminating
operation is similar to a SELECT DISTINCT. You can't use SELECT DISTINCT on
a column that is text type or image type or ntext type.
 
author & internet detective
Marshal
Posts: 38502
653
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Muhammad,
Thanks for posting the solution!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!