-
Georg Zilly
- PowerBuilder
- Thursday, 16 October 2025 09:43 AM UTC
Hi.
We additionally want to support MS SQL Server as backend db in future. Currently SQL Anywhere is used.
During migration of the database shema from SQL Anywhere to SQL Server any field previously was a long varchar was converted to a varchar(MAX) field.
Executing embedded SQL or a Datawindow using a field with that type in a WHERE clause produce an db error:
"...The data types varchar(max) and text are incompatible in the equal to operator.".
This also happens when update on a datawindow is executed and the varchar(MAX) field is selected in the update properties to be used in the where clause.
For example:
SELECT "note" INTO :ls_note FROM "QADMIN"."adr" WHERE "adressId" = :sle_addressno.text AND "note" = :ls_curNote USING iTransaction;
No problems when using constants:
SELECT "note" INTO :ls_note FROM "QADMIN"."adr" WHERE "adressId" = :sle_addressno.text AND "note" = 'test' USING iTransaction;
It looks to me as if the 'varchar(max)' fields are treated by PowerBuilder as fields of type 'text'.
We use ony ODBC connections in our application. Currently 'Microsoft ODBC Driver 18 for SQL Server' is used for SQL Server.
In PBODB.INI for SQL Server PBMaxTextSize='32767'
(Default) is used.
My envorinment: PB 2025 build 3683 on Windows 11. SQL Server 2022 on Windows Server 2019.
Is it possible to adjust this behaviour via configuration ('PBODB.INI') or a DBParam?
Are there any other ideas on how to solve the problem? I don't think that adding 'CONVERT' commands, as suggested by Google, is a good solution, as it is not feasible for the datawindow updates.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.