Board index » delphi » Problem reading MSSQL 7.0 varchar column when size > 255

Problem reading MSSQL 7.0 varchar column when size > 255

Hi All;

I have an MSSQL 7.0 Table defined with a varchar column (AField) declared
with a size of 2000.

An update SQL via a TQuery executes correctly and it includes the following
line:

   VarcharUpdate.ParamByname('FieldValue').Assign(aStringList);

Strangely, the param 'FieldValue' is declared is declared as a varbyte type,
there is no
varchar type. 400 chars are written to the field correctly, as inspection
with Entreprise
manager confirms.

When an SQL Select on the varchar field is executed, the maximum number of
chars I can
retrieve is 255.

The SQL statement is

"Select AField from NoBlob
where AnIndex = 1"

Delphi 4 does not allow the following statements:

aStringList.Assign('VarcharQuery.FieldByName'(AField')); or
aStringList.Assign('VarcharQuery.FieldByName'(AField').Value);

These only retrieve 255 bytes:

aStringList.Text:='VarcharQuery.FieldByName'(AField').Value; or
aStringList.Text:='VarcharQuery.FieldByName'(AField').asString;

Does anyone know how to retrieve the 400 chars?

Ta -John

 

Re:Problem reading MSSQL 7.0 varchar column when size > 255


Hi,
Unfortunately there is no way with Native drivers.
BDE Native drivers written using DBLibrary and for MSSQL7.0 and later
Microsoft will not update DBLibrary. So native drivers never can manage
features introduced in OLE DB. GUID fields, varchar columns longer than 255
char, etc.. can be managed only in ADO and this one will be included in
Delphi 5. But ADO will not be same as BDE, so upgrade will be difficult.

Quote
john becker <jbec...@netcom.ca> wrote in message

news:7p6o0i$n1i1@forums.borland.com...
Quote
> Hi All;

> I have an MSSQL 7.0 Table defined with a varchar column (AField) declared
> with a size of 2000.

> An update SQL via a TQuery executes correctly and it includes the
following
> line:

>    VarcharUpdate.ParamByname('FieldValue').Assign(aStringList);

> Strangely, the param 'FieldValue' is declared is declared as a varbyte
type,
> there is no
> varchar type. 400 chars are written to the field correctly, as inspection
> with Entreprise
> manager confirms.

> When an SQL Select on the varchar field is executed, the maximum number of
> chars I can
> retrieve is 255.

> The SQL statement is

> "Select AField from NoBlob
> where AnIndex = 1"

> Delphi 4 does not allow the following statements:

> aStringList.Assign('VarcharQuery.FieldByName'(AField')); or
> aStringList.Assign('VarcharQuery.FieldByName'(AField').Value);

> These only retrieve 255 bytes:

> aStringList.Text:='VarcharQuery.FieldByName'(AField').Value; or
> aStringList.Text:='VarcharQuery.FieldByName'(AField').asString;

> Does anyone know how to retrieve the 400 chars?

> Ta -John

Other Threads