Reputation: 8787
Is it possible to change the default collation based on a column? i want to make 1 column case sensitive but all the others not
Upvotes: 17
Views: 30180
Reputation: 1
The answer to your question is yes, already stated above by Anton Gogolev.
Additional Info:
Here is a how you can find list of Collation supported by your SQL Server based on its version.
select name,
COLLATIONPROPERTY(name, 'CodePage') as Code_Page,
description
from sys.fn_HelpCollations()
what is the meaning of Kanatype Sensitive KS and width sensitive
Upvotes: 0
Reputation: 882406
I don't specifically know SQL Server, but the generally accepted DBMS practice (for compatibility) would be to either:
There may be a faster way to do it in SQL Server but you should be careful of solutions that push workload into the SELECT statements - they never scale well. It's almost always better doing this as part of inserts and updates since that's the only time data changes - doing it that way minimizes the extra workload.
Upvotes: 3
Reputation: 115857
ALTER TABLE ALTER COLUMN
allows to change collation for a single column:
alter table Foo alter column Bar ntext collate Latin1_General_CS_AS
(collation might be incorrect)
Upvotes: 22