Laravel: Generated SQL throws error only on specific tables

前端 未结 2 1502
太阳男子
太阳男子 2021-01-14 13:59

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:

         


        
2条回答
  •  抹茶落季
    2021-01-14 14:20

    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.

提交回复
热议问题