版本:SQL Server 2017
问题:安装时没留意,使用的时候发现数据库名称需要区分大小写,不知道有没有方法可以修改成不区分。
数据库的排序规则已经是 Chinese_PRC_CI_AS
可以在设置里面改。
How to Check Case-Sensitivity in SQL Server
SQL Server is, by default, case insensitive; however, it is possible to create a case-sensitive SQL Server database and even to make specific table columns case sensitive. The way to determine if a database or database object is to check its "COLLATION" property and look for "CI" or "CS" in the result.
CI
= Case InsensitiveCS
= Case SensitiveSELECT SERVERPROPERTY('COLLATION')
A common result is:SQL_Latin1_General_CP1_CI_ASThe
CI
indicates that the server is case insensitive.SELECT collation_name
FROM sys.databases
WHERE name = 'your_database_name'
Again, this will output something like:SQL_Latin1_General_CP1_CI_AS
WHERE
clause and include name
in the SELECT
list:SELECT name, collation_name
FROM sys.databases
SELECT COLUMN_NAME, COLLATION_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'your_table_name' AND CHARACTER_SET_NAME IS NOT NULL
Another command for checking the case-sensitivity and other properties of the database server is:
EXECUTE sp_helpsort
This will return something like:
Latin1-General, case-insensitive, accent-sensitive, kanatype-insensitive, width-insensitive for Unicode Data, SQL Server Sort Order 52 on Code Page 1252 for non-Unicode Data
Finally, to see all collations supported by your SQL Server installation, run this:
SELECT name, description FROM sys.fn_helpcollations()
The result will be something like this:
您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~
如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~
ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632
非常感谢您使用有问必答服务,为了后续更快速的帮您解决问题,现诚邀您参与有问必答体验反馈。您的建议将会运用到我们的产品优化中,希望能得到您的支持与协助!
速戳参与调研>>>https://t.csdnimg.cn/Kf0y