Board index » delphi » Field contents truncated to 255 characters - why ?

Field contents truncated to 255 characters - why ?

I've written a data conversion routine that feeds data into a SQL
Server 7 database.  So I have code like:

destination.fieldbyName('Summary').asString := getMemoInfo(oldfield);

the getMemoInfo is returning long strings, I've not overridden the
default {$H+} directive to use widestrings and yet the text is
truncated to 255 characters.  The destination field Summary is defined
in SQL7 as 2000 varchar.

Is there something I'm not aware of, should I be using
destination.fieldbyName('Summary').asSomethingElse ?

Please any ideas would be gratefully received.

thanks, Rob
--------------------------------
email: Rob.Da...@unn.ac.uk
Web:   http://www.unn.ac.uk/~isu8

 

Re:Field contents truncated to 255 characters - why ?


Quote
> the getMemoInfo is returning long strings, I've not overridden the
> default {$H+} directive to use widestrings and yet the text is
> truncated to 255 characters.  The destination field Summary is defined
> in SQL7 as 2000 varchar.

The SQL Links driver for MSSQL does not support the new data types in SQL 7
like varchar > 255.  This is because SQL Links uses microsoft's DB-Lib
interface which microsoft did not update for SQL 7.

-Mike

Re:Field contents truncated to 255 characters - why ?


Yes I thought it might be the driver but if I write to a field of type
Text I can happily write more than 255 characters.  

This puzzled me so, within SQL7 Enterprise Manager, I tried inserting
a record to a table with a varchar field of length 2000.  This gave no
problem.  So, I thought the problem must be with the way my Delphi
program writes to a varchar field.  So then I created a program that
wrote to a Text field and it worked fine.  Then, and this is the
twist, I tried, within SQL7, inserting into a varchar field using a
select from the text field and once again the varchar field truncated
to 255.

So it would seem to be a bug in SQL7 not the SQL Links driver, or at
least not soley that.  Either way do you have any ideas or suggestions
for solutions?

regards, Rob

Quote
"Mike Williams" <m...@remove.aps-soft.com> wrote:
>> the getMemoInfo is returning long strings, I've not overridden the
>> default {$H+} directive to use widestrings and yet the text is
>> truncated to 255 characters.  The destination field Summary is defined
>> in SQL7 as 2000 varchar.

>The SQL Links driver for MSSQL does not support the new data types in SQL 7
>like varchar > 255.  This is because SQL Links uses microsoft's DB-Lib
>interface which microsoft did not update for SQL 7.

>-Mike

--------------------------------
email: Rob.Da...@unn.ac.uk
Web:   http://www.unn.ac.uk/~isu8

Re:Field contents truncated to 255 characters - why ?


Quote
> So it would seem to be a bug in SQL7 not the SQL Links driver, or at
> least not soley that.  Either way do you have any ideas or suggestions
> for solutions?

As far as I can tell, you're fine using memo fields under SQL 7 but varchar
fields > 255 just won't work.  Did you do the insert from a select statement
within a Delphi program or within the SQL Query Analyzer?

-Mike

Re:Field contents truncated to 255 characters - why ?


I did the insert from within the Enterprise Manager and as I said you
can insert more than 255 characters using an insert, but you can't if
the values for the insert come from a select statement - again within
Enterprise Manager.

Quote
"Mike Williams" <m...@remove.aps-soft.com> wrote:
>> So it would seem to be a bug in SQL7 not the SQL Links driver, or at
>> least not soley that.  Either way do you have any ideas or suggestions
>> for solutions?

>As far as I can tell, you're fine using memo fields under SQL 7 but varchar
>fields > 255 just won't work.  Did you do the insert from a select statement
>within a Delphi program or within the SQL Query Analyzer?

>-Mike

--------------------------------
email: Rob.Da...@unn.ac.uk
Web:   http://www.unn.ac.uk/~isu8

Other Threads