BDE TQuery reading a SQL Server VarChar(500)

Posted on 2004-11-17
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

       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


    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

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
    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.
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
    The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now