Solved

The text, ntext, and image data types are invalid in this subquery or aggregate expression.

Posted on 2004-08-02
6
524 Views
Last Modified: 2006-11-17
SELECT MIN(Memo) FROM PmtsMemos WHERE PmtsMemos.InfinityRecNo = 0

in this example the memo field is ntext.

What can i do?

0
Comment
Question by:tricks801
  • 4
6 Comments
 
LVL 11

Expert Comment

by:SweatCoder
ID: 11696264
what's the problem? an error?
0
 

Author Comment

by:tricks801
ID: 11696302
ok, the Min was a mistake...but this is found as a subquery, so it is still coming up with the same error
0
 

Author Comment

by:tricks801
ID: 11696307
sorry....the error is stated in the title:  The text, ntext, and image data types are invalid in this subquery or aggregate expression.
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

Author Comment

by:tricks801
ID: 11696321
a very simplified version of the actual query...
select (SELECT (Memo) FROM PmtsMemos WHERE PmtsMemos.InfinityRecNo = 620073)
0
 
LVL 1

Accepted Solution

by:
seangw earned 500 total points
ID: 11696363
You can't select a min or max of a binary type (aggregate functions on ntext, etc.)  if you want to do so, you can try to convert the type to an integer then do the min on it.

This should raise the question on whether you are using the correct datatype here.  If you are always going to have numbers, you are best off correctly classifying the field as int, or float, to speed up the database as well as open up these useful aggregate functions.
0
 

Author Comment

by:tricks801
ID: 11696421
the agg function was a mistake... i fixed it by cast(memo as nvarchar)

thanks
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Dump exec output to table 3 21
Run Stored Procedure uisng ADO 5 20
Shrink multiple databases at once 4 26
SQL Recursion 6 18
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question