Like, ilike et sensibilité à la casse

07.01.2008, 12:48 Par défaut, like n'est pas sensible à la casse,

ilike n'existe pas sous mysql, il faut utiliser une astuce avec collate pour que ca marche (voir ci dessous).

Citation By default, MySQL searches are not case sensitive. This means that if you search with col_name LIKE 'a%', you get all column values that start with A or a. If you want to make this search case sensitive, make sure that one of the operands has a case sensitive or binary collation. For example, if you are comparing a column and a string that both have the latin1 character set, you can use the COLLATE operator to cause either operand to have the latin1_general_cs or latin1_bin collation. For example:

col_name COLLATE latin1_general_cs LIKE 'a%'
col_name LIKE 'a%' COLLATE latin1_general_cs
col_name COLLATE latin1_bin LIKE 'a%'
col_name LIKE 'a%' COLLATE latin1_bin

If you want a column always to be treated in case-sensitive fashion, declare it with a case sensitive or binary collation.


http://dev.mysql.com/doc/refman/5.0/en/case-sensitivity.html
mumuri cinemona.com
mumuri
mumuri
Messages : 14 368

  • astuces de jeux vidéos
  • livres bds roman
  • allo ciné
  • forum
  • dessin animé
  • séries télé
  • smileys
  • avis livres
  • avis films & streaming
  • actualité de jeux vidéos
  • bourse
  • anime
Tous droits réservés © 2002-2009 . Top flood. Crédits des logiciels tiers     .