Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
cool.mugil
Starting Member
32 Posts |
Posted - 2008-11-11 : 06:18:00
|
Hi all, I have a SQL Stmt something like this: SELECT id,photo from table1UNIONSELECT id,photo from table2note: the photo field type is image I want to query the distinct records so i dont want to use the UNION ALL but I'm receiving the error msg belowThe text, ntext, or image data type cannot be selected as DISTINCT.Im Just wondering if there is any work around to the above SQL Stmt. Thanks in advance . |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-11 : 06:44:33
|
if you're using sql 2005 cast iamge to varbinary(max) & try |
|
|
cool.mugil
Starting Member
32 Posts |
Posted - 2008-11-11 : 07:05:44
|
I am using sql server 2000. |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2008-11-12 : 09:08:16
|
It seems like a bad design to have the same data in 2 tables, especially if you want to know if the same photo exists in both.Maybe you can try to checksum or hash the image data and store that with the image in both tables. That will make for a much faster and efficient way of finding the distinct set. |
|
|
|
|
|