I have a database in which there are many VARCHAR(1000) fields, but it seems that zeos 6.6.6 always returns only the first 256 charaters.
Is there a solution for this problem?
I cannot alter the database, so I must find a solution within delphi.
VARCHAR over 256 characters return always 256?
Moderators: gto, cipto_kh, EgonHugeist
-
- Expert Boarder
- Posts: 164
- Joined: 18.03.2008, 13:03
- Contact:
hello noctrex,
I don't know how it is with ms sql, but with postgresql I use text datatype in DB for fields that are more than 255 char long. That way I get memofield instead of stringfield and it may contain more than 255 chars.
Maybe someone here with experience using ms sql will add some new ideas...
Good luck!
I don't know how it is with ms sql, but with postgresql I use text datatype in DB for fields that are more than 255 char long. That way I get memofield instead of stringfield and it may contain more than 255 chars.
Maybe someone here with experience using ms sql will add some new ideas...
Good luck!
Thanks for your answer, I've tried the following on a test database:
when using a nvarchar(max) field (I need an N* type field for encoding greek charaters) I get this error:
"General SQL Server error: Check messages from the SQL Server. Unicode data in a Unicode-only collation or ntext data cannot br sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier."
And when I try to get a ntext field I get the following:
"General SQL Server error: Check messages from the SQL Server. Argument data type ntext is invalid for argument 1 of replace function."
Only setting the field to a nvarchar(N) works, but always only getting the first 256 characters :/
For the record, I'm using Delphi 7 with Zeos 6.6.6
when using a nvarchar(max) field (I need an N* type field for encoding greek charaters) I get this error:
"General SQL Server error: Check messages from the SQL Server. Unicode data in a Unicode-only collation or ntext data cannot br sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier."
And when I try to get a ntext field I get the following:
"General SQL Server error: Check messages from the SQL Server. Argument data type ntext is invalid for argument 1 of replace function."
Only setting the field to a nvarchar(N) works, but always only getting the first 256 characters :/
For the record, I'm using Delphi 7 with Zeos 6.6.6
Small quick'n'dirty workaround for this issue:
I just split, inside the sql query, the long varchar into pieces of 250 chars like this:
SUBSTRING(ISNULL(Ap_Memo, ''''), 0, 250) AS Ap_Memo01,
SUBSTRING(ISNULL(Ap_Memo, ''''), 250, 250) AS Ap_Memo02,
SUBSTRING(ISNULL(Ap_Memo, ''''), 500, 250) AS Ap_Memo03,
SUBSTRING(ISNULL(Ap_Memo, ''''), 750, 250) AS Ap_Memo04,
SUBSTRING(ISNULL(Ap_Memo, ''''), 1000, 250) AS Ap_Memo05,
.. and so on...
and concatenate them back together into one large string inside Delphi.
I know it's not optimal, but at least it works.
I just split, inside the sql query, the long varchar into pieces of 250 chars like this:
SUBSTRING(ISNULL(Ap_Memo, ''''), 0, 250) AS Ap_Memo01,
SUBSTRING(ISNULL(Ap_Memo, ''''), 250, 250) AS Ap_Memo02,
SUBSTRING(ISNULL(Ap_Memo, ''''), 500, 250) AS Ap_Memo03,
SUBSTRING(ISNULL(Ap_Memo, ''''), 750, 250) AS Ap_Memo04,
SUBSTRING(ISNULL(Ap_Memo, ''''), 1000, 250) AS Ap_Memo05,
.. and so on...
and concatenate them back together into one large string inside Delphi.
I know it's not optimal, but at least it works.
256 chars limit
Hi,
Using ntwdblib from microsoft it will limit the varchar to 256. This is a driver limitation. You can use ADO, or freeTDS in order to use varchar with more than 256 chars. It should work also with unicode data ....
Bogdan
Using ntwdblib from microsoft it will limit the varchar to 256. This is a driver limitation. You can use ADO, or freeTDS in order to use varchar with more than 256 chars. It should work also with unicode data ....
Bogdan