无效的列名称,MS SQL Server中的列重音符号 [英] Invalid column name, column accents in MS SQL Server

查看:81
本文介绍了无效的列名称,MS SQL Server中的列重音符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用一个旧数据库,该数据库的列名包含重音符号。当我尝试在Codeigniter(PHP)中执行此查询时:

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]

系统抛出错误


无效的列名'Código'。 (列名称为Código)

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

我尝试使用 COLLATE

I've tried using COLLATE function with no success.

MS SQL Server数据库默认排序规则为 Modern_Spanish_CI_AI ,列排序规则为 SQL_Latin1_General_CP1_CI_AS

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

如何解决此问题?

Codeigniter具有配置字段名称 dbcollat​​ion,该字段设置用于与数据库进行通信的排序规则,但是我不知道它是否会影响此问题(我已经测试了一些值也没有成功)。

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).

谢谢。

推荐答案

您应该将数据库集合转换为utf8_general_ci

You should convert your database collection into utf8_general_ci

这篇关于无效的列名称,MS SQL Server中的列重音符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆