Wednesday, February 22, 2006
A sensitive SQL issue
Unlike unix world, Microsoft world is not much finicky about alphabet’s case. It really doesn’t matter about in which we execute commands. Mostly, it accepts all phase of alphabets (lower, UPPER and mIxEd). As like other MS products, SQL Server do accepts commands in all cases. However few SQL commands are case sensitive. For example BCP command. This command-line program’s parameters are case sensitive.
In contrary to windows user name and password, SQL Login name and password are generally not case sensitive, but it depends on the SQL Server’s collation setting. If the SQL collation is case sensitive, then SQL login passwords also case-sensitive. In a case sensitive SQL Server or Database, all comparison operators, SQL identifiers are sensitive about case.
… WHERE name = ‘SQL’ is different than … WHERE name=’sql’
… WHERE NAME = ‘SQL’ is different than … WHERE name = ‘SQL’
So, if the business is not much concern about the alphabet case, then we need to chose a collation which named like CI (case Insensitive) rather than CS (case sensitive).
In contrary to windows user name and password, SQL Login name and password are generally not case sensitive, but it depends on the SQL Server’s collation setting. If the SQL collation is case sensitive, then SQL login passwords also case-sensitive. In a case sensitive SQL Server or Database, all comparison operators, SQL identifiers are sensitive about case.
… WHERE name = ‘SQL’ is different than … WHERE name=’sql’
… WHERE NAME = ‘SQL’ is different than … WHERE name = ‘SQL’
So, if the business is not much concern about the alphabet case, then we need to chose a collation which named like CI (case Insensitive) rather than CS (case sensitive).