Library code snippets
How to include Text, nText and Image datatypes in a Union query
As you probably know, in Microsoft database parlance the Text, nText and
Image datatypes all hold very large amounts of data. If you've ever tried to add
these types to a Union query in Visual Basic, the query probably generated
errors, claiming that the Text, nText or Image data type can't be selected as
DISTINCT.
When you run a UNION query, the keyword forces the database to eliminate
duplicates from the results--the equivalent of adding the DISTINCT keyword to
the SQL statement. Text, nText and Image fields, by their very blobular nature,
are potentially too large to be compared one by one by the database. As a
result, you can't select unduplicated records when displaying fields of these
data types.
Fortunately, SQL offers a way around this with the UNION ALL clause. This clause
works exactly like the UNION keyword, except that it selects all records,
duplicates or not. The following SQL provides an example:
SELECT id1, memoText
FROM dbo.tblCatalog
UNION ALL
SELECT id3, browseImage
FROM dbo.tblImages
Related articles
Related discussion
-
MS Access in 3 different language
by buvanasubi (1 replies)
-
copying access DB to SQL DB
by Lufuno (0 replies)
-
How to receive data in web server sending from GPRS modem
by ashok.infotech (0 replies)
-
How do I update a table that has an ID from a table that does not have an ID but has a PIDM?
by konikula (1 replies)
-
how to make smtp in vb.net
by shahid123 (0 replies)
Related podcasts
-
Stack Overflow: Podcast #28
This is the twenty-eighth episode of the StackOverflow podcast, where Joel and Jeff discuss Windows Azure, SQL Server 2008 full text search, Bayesian filtering, porn detection, and project management — among other things. Jeff met the inestimable Joey DeVilla aka Accordion Guy...
Related jobs
-
Microsoft .Net Architect
in AMSTERDAM (€50K-€90K per annum) -
Oracle Apps Database Administrator - Standplaats: Utrecht
in AMSTERDAM (€50K-€90K per annum) -
Business Analist BI/Datawarehousing
in Amsterdam (€50K-€90K per annum) -
Oracle Ontwikkelaar
in Amsterdam (€50K-€90K per annum)
Events coming up
-
Jun
16
Code Generation 2009
Cambridge, United Kingdom
A developer event with a practical focus on helping people get to grips with code generation tools and technologies.
This thread is for discussions of How to include Text, nText and Image datatypes in a Union query.