• Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

SQL Server collations

AtW

I post more often than I breathe
Joined
Jul 6, 2005
Messages
63,203
Likes received
5,553
Thanks received
1,318
... with case insensitivity being default for strings...

:tantrum:

:bang:

:mad

:throw:

:suicide:
 
are you mad because the collation is case insensitive?
Thats considered normal practice :confused:
 
are you mad because the collation is case insensitive?

Yes.

I should have paid more attention to default collations - using case insensitive is nuts. :eyes
 
Yes.
using case insensitive is nuts. :eyes

Why? I just think case sensitivity is a pain in anything 'pooter related. Never performed a development or database task that benefitted from it.

Only reason i can think of is if you are deploying it somewhere else that IS case sensitive. Having something where ID, Id and id are different things is just horrible.
 
Last edited: 21:38
Ugh, Latin1_general_bin is the bane of my part time work at the moment!

Why would anyone want A to come after b!

If you need it for one particular field use the collate clause ie select textfield1 collate latin1_general_bin from blah

Why doom the whole database to be bin!

I doubt you'd have much of a case for performance gains these days either so don't try that one.
 
If you don't want case sensitive query you can use lower() or (if you are concerned about performance) lower case data before inserting it into database, or have another lower cased field if you need both.

:fight:

Anyway bug is fixed and lesson learnt: I was going to yank SQL Server out of the window soon, and now that's going to happen a lot sooner :eyes
 
Yes.

I should have paid more attention to default collations - using case insensitive is nuts. :eyes

Why do you want case sensitivity?

In EVERY system I've worked on having a case sensitive database would have been a nightmare
 
Why do you want case sensitivity?

Data is case sensitive - we were storing URLs that were checked to be unique for given report before insertion, this was causing issues due to case insensitive nature of default collation. Solved now, but a bit annoyed - defaults in my view should not have such sneaky side effects: this effectively forces to use explicit collation in SQL, leading to dirty code.

In EVERY system I've worked on having a case sensitive database would have been a nightmare

Then you are not Spartacus! :hug:
 
defaults in my view should not have such sneaky side effects: this effectively forces to use explicit collation in SQL, leading to dirty code.

Change the view to specify collation then

Default collation is set at instance level and can easily be determined during install.
If it's that important then fire your DBA and get someone who knows what they're doing in!
 
Default collation is set at instance level and can easily be determined during install.

Could not change it on database level even on my small test DB, decided to walk away from that risk and just used COLLATE in SQL, this part of the SKA is definately going out of relational DB, out out out ...

I'd gladly follow your advice and fire our DBA but that would be like firing myself...
 

Advertisers

Back
Top