开发者

SQL and Case Insensitive Conditions

I have noticed in My开发者_开发百科SQL a where clause like WHERE x = 'Test' will match regardless of case ('TEST', 'test', etc.)

When using PDO, is it fair to assume that this is the case with most database servers? For example, If I were to use MSSQL or Oracle, would this be the same case?


It's not the server that it depends on, but the collation. Most databases will default to a case insensitive collation, so you can assume that, but if you ever run into one that is case sensitive it is easy to change.


Oracle is case sensitive with data by default e.g.

select * from 'test';

does not equal

select * from 'TEST';

Been a while since I last used them but I seem to recall Informix beiung case sensitive and Sybase I think is dependant on the collation.

As noted by other respondandt SQL Server is dependant on the collation.

So I think the only real answer is it depends on the RDBMS


SQL Server is case insensitive by default. In SQL Server you can use Collation to use case sensitive comparisons, see here.

Oracle is case sensitive by default. You can use the 'UPPER' statement to perform case insensitive searches, see here.


You're correct, sql in general is case insensitive for string matching and that goes for almost all servers.

Here's an article showing how to do a case sensivive match in different ways though if you need it!

http://vyaskn.tripod.com/case_sensitive_search_in_sql_server.htm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜