How to determine if an instance of SQL Server is case sensitive or not

倾然丶 夕夏残阳落幕 提交于 2019-12-01 03:24:58

问题


How can I find out if an instance of SQL Server 2005 allows case sensitive databases or not?

By case sensitive, I mean case sensitivity of the objects in the database, i.e. the following two statements are not equivalent:

SELECT * FROM TABLE
SELECT * FROM table

I've looked in the property pages of the server (in Management Studio) but I couldn't see it.


回答1:


SELECT DATABASEPROPERTYEX('DatabaseNameHere', 'Collation') SQLCollation;

Returns "SQL_Latin1_General_CP1_CI_AS", the CI is what indicates case insensitivity




回答2:


In Management studio, right click on Instance in the object explorer and then click on "properties" to see the server properties. In the "General" section look at the collation. The default case insensitive setting is SQL_Latin1_General_CP1_CI_AS. The case sensitive setting is Latin1_General_CS_AS.




回答3:


The collation of a database can be different to the server collation. There is no restriction.

When you CREATE DATABASE, you specify it there or it assumes the collation of the model databases (which should be the server collation).

SELECT
    DATABASEPROPERTYEX('MyDB', 'Collation'), 
    SERVERPROPERTY ('Collation')


来源:https://stackoverflow.com/questions/1439485/how-to-determine-if-an-instance-of-sql-server-is-case-sensitive-or-not

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