Question Michoel Reach · Mar 28, 2023

MAXLENGTH for VARCHAR in ODBC

In the documentation  Data Types | Caché SQL Reference | Caché & Ensemble 2018.1.4 – 2018.1.8 (intersystems.com)

it says that "by default, Caché establishes a system-wide ODBC VARCHAR maximum length of 4096; this ODBC maximum length is configurable"

Per instructions, I went to SMP -> System -> Configuration -> General SQL Settings, where most of the fields from  $SYSTEM.SQL.CurrentSettings()

appear. That one does not.

How does one change it, and can it be increased?

Thanks!

[Cross-posted from https://groups.google.com/g/intersystems-public-cache/c/eRFeORb_sb0]

Product version: Caché 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.4 (Build 505_1_20258U) Thu Sep 10 2020 10:22:22 EDT

Comments

Lucas Fernandes · Mar 29, 2023

You can try to change using Config.SQL class.

Example:
 

%SYS>w$SYSTEM.SQL.CurrentSettings()
ODBC VARCHAR Max Length:                     4096 (Default)

%SYS>do##class(Config.SQL).Get(.p)
%SYS>zw p("ODBCVarcharMaxlen")
p("ODBCVarcharMaxlen")=4096%SYS>set p("ODBCVarcharMaxlen") = 5120%SYS>do##class(Config.SQL).Modify(.p)

%SYS>w$SYSTEM.SQL.CurrentSettings()
ODBC VARCHAR Max Length:                     5120
0