Can't use whereIn to query a SQL Server 2000 using freetds driver
Hi. I'm using Laravel 5.6.29 to connect to an old SQL Server 2000 from Ubuntu 18.04 using ODBC with FreeTDS.
This query works perfectly:
\DB::connection('sqlsrv')->select("select * from [tb_Organizaciones] where [NivelDependiente] in (1,2,3,4)")
This one doesn't
App\CAD_Organizacion::whereIn('NivelDependiente', [1,2,3])->get()
tinker prints this exception message:
Illuminate/Database/QueryException with message 'SQLSTATE[42000]: Syntax error or access violation: 306 [FreeTDS][SQL Server]The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator. (SQLExecute[306] at /build/php7.2-Z045KC/php7.2-7.2.7/ext/pdo_odbc/odbc_stmt.c:260) (SQL: select * from [tb_Organizaciones] where [NivelDependiente] in (1, 2, 3))'
The same exception occurs even when i use where() instead of a whereIn()
What's the problem and the corresponding solution?
Please or to participate in this conversation.