views:

467

answers:

3

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.

+3  A: 
SELECT DATABASEPROPERTYEX('DatabaseNameHere', 'Collation') SQLCollation;

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

Josh Stodola
you mean "MyDatabasename"?
gbn
Yes, good call! Updated!
Josh Stodola
Thanks, just to confirm (for anyone else who might find this question), collation determines whether or not database objects (such as tables) are equal AS WELL as determining if text values stored in the database are.
Kragen
@kragen2uk: of course. object names are stored in sys.objects, which is subject to collation...
gbn
+1  A: 

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.

Matt Wrock
+1  A: 

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')
gbn