Laravel: Generated SQL throws error only on specific tables

前端 未结 2 1505
太阳男子
太阳男子 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:32

    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

    • http://msdn.microsoft.com/en-us/library/aa937590(v=sql.80).aspx (1)
    • https://github.com/laravel/framework/blob/master/src/Illuminate/Database/Connectors/SqlServerConnector.php#L47 (2)

提交回复
热议问题