?
Solved

Delphi TIBQuery Error

Posted on 2006-04-27
6
Medium Priority
?
252 Views
Last Modified: 2010-04-05
Hi Friends,

I have a TIBQuery component and receive an error when running my SQL query.
This is the SQL statement:
-----------------------------------SQL STATEMENT-------------------------------------
SELECT '+
    'CUSTOMEREMAILINID, CUSTOMERID, EMAILDATE, FROMEMAIL, HASREAD, MESSAGESOURCE, SUBJECT, TOEMAIL, ' +
    'COUNT(CUSTOMEREMAILINID) AS ROWCOUNT ' +
    'FROM '+
    'TBLCUSTOMEREMAILSIN ' +
    'WHERE ' +
    'CUSTOMERID = :CUSTOMERID ' +
    'GROUP BY '+
    'CUSTOMEREMAILINID, CUSTOMERID, EMAILDATE, FROMEMAIL, HASREAD, MESSAGESOURCE, SUBJECT, TOEMAIL '+
    'ORDER BY '+
    'EMAILDATE, CUSTOMERID
--------------------------------------------------------------------------------------------------

The error message I receive when opening the query is:
"conversion error from string 'BLOB' ".

Can someone please advice.

Thanks a million!
0
Comment
Question by:Marius0188
  • 4
6 Comments
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 16550859
Which of your fields is a BLOB field as if I remember right you can't use it as part of a GROUP
0
 

Author Comment

by:Marius0188
ID: 16551320
Field: MESSAGESOURCE  is ftBlob.

0
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 16551324
Also just as a side note I would not probably label a column as ROWCOUNT as this might be reserved.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 15

Accepted Solution

by:
mikelittlewood earned 500 total points
ID: 16551337
Assuming that CUSTOMEREMAILINID is the unique field on this table, try changing to a nested query to get the message (indexing the primary column will speed this up if the table is large).

SELECT '+
    'CUSTOMEREMAILINID, CUSTOMERID, EMAILDATE, FROMEMAIL, HASREAD, SUBJECT, TOEMAIL, ' +
    'COUNT(CUSTOMEREMAILINID) AS ROWCOUNT, ' +
    '(SELECT MESSAGESOURCE FROM TBLCUSTOMEREMAILSIN WHERE CUSTOMEREMAILINID = T.CUSTOMEREMAILINID) AS MESSAGESOURCE ' +
    'FROM '+
    'TBLCUSTOMEREMAILSIN T ' +
    'WHERE ' +
    'CUSTOMERID = :CUSTOMERID ' +
    'GROUP BY '+
    'CUSTOMEREMAILINID, CUSTOMERID, EMAILDATE, FROMEMAIL, HASREAD, SUBJECT, TOEMAIL '+
    'ORDER BY '+
    'EMAILDATE, CUSTOMERID
--------------------------------------------------------------------------------------------------
0
 
LVL 17

Expert Comment

by:TheRealLoki
ID: 16573919
I don't think you can use a blob in a "group by"
you could try declaring it as a memo type instead
0
 
LVL 15

Expert Comment

by:mikelittlewood
ID: 16587198
Yeah thats why I re-wrote his query as a nested one just to bring back the blob field (if he doesnt need to group by it)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month17 days, 4 hours left to enroll

864 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