BDE TQuery reading a SQL Server VarChar(500)

Posted on 2004-11-17
Medium Priority
Last Modified: 2013-11-23

I have a Table on SQL Server having a VarChar(500) field.  When I query this table using a TQuery component, it only returns the first 255 characters from the 500 char field.

I tried the same thing with TADOQuery object and it worked fine, all 500 char were returned.

I HAVE to use a TQuery object (I cannot switch to a TADOQuery).

Can anyone help me with this ?

Thanks :)
Question by:qas
LVL 22

Accepted Solution

Mohammed Nasman earned 1000 total points
ID: 12635968
   The problem came from MS side, BDE uses DBLibrary for accessing Sql server, and MS didn't update the DBLibrary for sql server 7 and above to allow the new data types and varchar > 255

to solve this problem you need to switch to ADO

BTW, there's area of Delphi topic, if you ask the question there you will got a better and more comments for your questions

Mohammed Nasman

Expert Comment

ID: 13823798

with the same problem, my solution
   WHEN len(texte) > 255 THEN substring(texte,1,255)
   ELSE texte
END as texte1,
   WHEN len(texte) > 255 THEN substring(texte,255,len(texte)-255)
   ELSE ''
END as texte2

After in the program, Query.FieldByName('texte1').AsString + Query.FieldByName('texte2').AsString

Emmanuel Guillot

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses
Course of the Month16 days, 9 hours left to enroll

862 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