March 26, 2009 at 1:00 am
hi,
In my database I created one table and add one column.
column name is : column1 ..
when i used select query select .
select COLUMN1 FROM table ..
it showing data.. how can i change the database to case sensitive..
I am using sql server 2005 ctp expressedition..
regards:
giri...
Thanks
Dastagiri.D
March 26, 2009 at 2:54 am
So whats the proble it must not show column1 when give COLUMN1.
I dont think there is an option for that.
Tanx 😀
March 27, 2009 at 5:13 am
Hi,
you can change the server collation, check http://msdn.microsoft.com/en-us/library/ms179254.aspx
Regards,
René
March 27, 2009 at 5:26 am
Note that you can also change your database, or table collation as well (if you don't want your entire server running that way)
So if you're using SQL_Latin1_General_CP1_CI_AS, try SQL_Latin1_General_CP1_CS_AS
ALTER DATABASE COLLATE SQL_Latin1_General_CP1_CS_AS
March 27, 2009 at 6:21 am
Why do you want to change to case sensitive?
"Keep Trying"
March 27, 2009 at 9:42 am
You do not have to change the database or column collation in order to use different collations for specific tasks. In fact you can mix collations to match your needs.
If you have your database built with case insensitve collation but would like to do case sensitive search just use the COLLATE keyword.
For example the first select will find all records where test code is 'ABC' regardless of the case - so abc, AbC aBc and such will be found. The second one will find only the record matching the case of the specified string 'ABC' in this case. The third example will mix the case sensitive and case insensitive search in one query.
SELECT * FROM Tests
WHERE TestCode = 'ABC'
SELECT * FROM Tests
WHERE TestCode = 'ABC' COLLATE Latin1_General_CS_AS
SELECT * FROM Tests
WHERE TestCode = 'ABC' COLLATE Latin1_General_CS_AS
OR TestCode = 'CBS'
---------------------------------------------
[font="Verdana"]Nothing is impossible.
It is just a matter of time and money.[/font]
March 27, 2009 at 1:13 pm
Note that changing server or database collation does NOT change the collation for pre-existing columns/data. There's only one way to do that:
Create a brand new empty database in the desired collation and migrate the data into that DB.
Simplest thing to do is to use the COLLATE option, though (as mentioned above).
MSSQLTIPS just had an article on that today: slightly different context but same issue
March 27, 2009 at 6:42 pm
Read about it at http://www.db-staff.com/index.php/microsoft-sql-server/69-change-collation
MJ
July 24, 2018 at 5:48 am
Alternatively, if the database already exists, right-click the database that you want and click Properties. Click the Options page, and select a collation from the Collation drop-down list.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply