Varchar(max) translates to string(65536) nvarchar(max) to WideMemo

Hi,

I found out that varchar(max) translates to a string of max 64k.
nvarchar(max), text and ntext translate to (Wide)Memo fields in DASM.

I think varchar(max) should be a Memo field.

I made a little test table:

I use MSSQL Server (2014), ADO driver SQLOLEDB (also tried SQLNCLI11.1). RO 9.4.109.1377

Is their a workaround for this problem?

Kind regards,

Mies

Thanks, logged as bugs://82081

bugs://82081 got closed with status fixed.

Hi,

By some reason, MSSQL returns varchar(-1) for varchar(max) and nvarchar(0) for nvarchar(max).
it was a reason for such failure.

you can update uDAADOInterfaces.pas as

procedure MSSQL_DoGetTableFields(const aTableName: string; Query: IDAServerDataset; out Fields: TDAFieldCollection;isAzure: Boolean);
...
   if Query.FieldByName('COL_LEN').AsInteger <= 0 then //changed, was `= 0`
..
   if Query.FieldByName('COL_LEN').AsInteger <= 0 then //changed, was `= 0`

after this, you can rebuild DAADODrv.dpr and put created DAADODrv.dad near to DASchemaModeler7.exe (it is in C:\Program Files (x86)\RemObjects Software\Data Abstract (Common)\Bin folder).

or just replace String with Memo in Schema Modeler

Thanks for the quick fix.
But this will overwrite the fix I received last week: Problems with Schema modeler Delphi - Unable to obtain Target Table metadata from connection - #12 by EvgenyK

Can you send the DAADODrv.dad with both fixed?

Thanks

DAADODrv.zip (1.1 MB)

1 Like