mavinoo / laravelBatch

insert batch and update batch in laravel
MIT License
571 stars 118 forks source link

operator does not exist: ` character varying when using SQL-Server #69

Open nexterid opened 3 years ago

nexterid commented 3 years ago

when using SQLServer throw this error

[Illuminate\Database\QueryException] "SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near '`'. (SQL: UPDATE ...

so I need to remove backtick symbol from vendor\mavinoo\laravel-batch\src\Batch.php

from

if ($driver == 'pgsql' ) $final[$field][] = 'WHEN ' . $index . ' = \'' . $val[$index] . '\' THEN ' . $value . ' ';


to

if ($driver == 'pgsql' || $driver == 'sqlsrv') $final[$field][] = 'WHEN ' . $index . ' = \'' . $val[$index] . '\' THEN ' . $value . ' ';

mavinoo commented 3 years ago

hi @nexterid install version v2.2.9

disable backtick for driver pgsql & sqlsrv , commit: d3392a0