zephyr_hex (Megan)
asked on
Informix SQL : select distinct and text field
In Informix, is there a way to convert or cast a text field so that i am able to SELECT DISTINCT ?
ASKER
before i posted, i tried cast(mytextfield as varchar(255))
i tried your suggestion, and i'm still getting the same message: No cast from text to lvarchar.
i tried your suggestion, and i'm still getting the same message: No cast from text to lvarchar.
Another option should be:
SELECT DISTINCT substr(text,1,length(text) ) ...
SELECT DISTINCT substr(text,1,length(text)
If above solution fails, then you cannot SELECT DISTINCT from text column and the only solution is to write/find out some checksum function.
ASKER
can you provide an example of how the checksum would work?
also... does Informix just not allow that type of conversion? i can do it in SQL 2005.
also... does Informix just not allow that type of conversion? i can do it in SQL 2005.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT DISTINCT CAST(YourTextColumn AS LVARCHAR(10000)) ...
It is not obvious to select distinct records this way. Better solution is to calculate some checksum from TEXT column and then select distinct based on this checksum.