Invalid column name, column accents in MS SQL Server

前提是你 提交于 2019-12-25 02:13:01

问题


I'm currently working with an old database that has column names containing accents. When I try to execute this query in Codeigniter (PHP):

SELECT *
FROM [empresas] [em]
LEFT JOIN [clientes] [cl] ON [em].[empresa] = [cl].[Código]

The system throws the error

"Invalid column name 'Código'". (the column name is 'Código')

I've tried using COLLATE function with no success.

The MS SQL Server database default collation is Modern_Spanish_CI_AI and the column collation is SQL_Latin1_General_CP1_CI_AS.

How can I solve this problem?

Codeigniter has a configuration field name "dbcollation" that sets the collation used to communicate with the database but I don't know if it affects in this problem (I've tested some values with no success too).

Thank you.


回答1:


You should convert your database collection into utf8_general_ci



来源:https://stackoverflow.com/questions/47977752/invalid-column-name-column-accents-in-ms-sql-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!