I am accessing MS SQLServer through Laravel, using Eloquent ORM or Query Builder. This works fine on all tables, but one particular table throws this error:
Please try :
$handle = getHandle();
$handle->exec('SET QUOTED_IDENTIFIER ON');
$handle->exec('SET ANSI_WARNINGS ON');
$handle->exec('SET ANSI_PADDING ON');
$handle->exec('SET ANSI_NULLS ON');
$handle->exec('SET CONCAT_NULL_YIELDS_NULL ON');
OR
You can also check the server configuration: check the "/etc/freetds.conf " file and change the tds version and add client charset then in php.ini please check mssql.charset and default_charset
in /etc/freetds.conf :
;tds version = 4.2
tds version = 8.0
client charset = UTF-8
In php.ini :
mssql.charset = "UTF-8"
default_charset = "utf-8"
Thanks.
Laravel uses db-library (if it's available) to connect to Sql Server which cannot receive unicode data from MSSQL. (1,2)
If you don't have to save unicode data in 'LeistungsBeschreibung', change the column datatype to varchar.
You may want to checkout the accepted answer to a similar question: MSSQL Query issue in PHP and querying text data
Links