[thelist] [SQL Server] Can you do a UNION on a text column?

Mark Mandel mark.mandel at gmail.com
Thu Sep 15 19:00:36 CDT 2005

Paul - 

FANTASTIC! I'm going to try that right now... I don't need the
'DISTINCT' nature of a UNION, I just need to pile it on top.

* prays this works and does a little jig! *


On 9/15/05, Paul Cowan <evolt at funkwit.com> wrote:
> On 15/09/2005 6:00 PM +1000 Mark Mandel wrote:
> > I have a bad feeling the answer is going to be 'no' - but is there a
> > way in which you can do a UNION on a SQL server field that is of type
> > 'text'.
> Well, you could convert the text to a var...
> > I can't convert the text field to varchar, as the text is longer than
> > 8000 characters.
> ... oh. Then no. You can't do a UNION.
> BUT (if it suits) you CAN do a UNION ALL. This may or may not be
> appropriate, but if it is, it should work fine.
> The difference (if you didn't know) is that a UNION ALL just piles all the
> data together, while a UNION effectively performs a DISTINCT on the result
> -- and you can't do DISTINCT across LOB (text, ntext, or image) fields,
> hence your problem. If your data doesn't contain duplicates, or you don't
> mind if duplicates come out, you'll be A-OK.
> Cheers,
> Paul Cowan

E: mark.mandel at gmail.com
W: www.compoundtheory.com
ICQ: 3094740

More information about the thelist mailing list