How do I perform an accent insensitive compare (e with è, é, ê and ë) in SQL Server?

Coerce to an accent insensitive collation You’ll also need to ensure both side have the same collation to avoid errors or further coercions if you want to compare against a table variable or temp table varchar column and because the constant value will have the collation of the database Update: only for local variables, not … Read more

How do I sort unicode strings alphabetically in Python?

IBM’s ICU library does that (and a lot more). It has Python bindings: PyICU. Update: The core difference in sorting between ICU and locale.strcoll is that ICU uses the full Unicode Collation Algorithm while strcoll uses ISO 14651. The differences between those two algorithms are briefly summarized here: http://unicode.org/faq/collation.html#13. These are rather exotic special cases, … Read more

Efficiently replace all accented characters in a string?

Here is a more complete version based on the Unicode standard. var Latinise={};Latinise.latin_map={“Á”:”A”, “Ă”:”A”, “Ắ”:”A”, “Ặ”:”A”, “Ằ”:”A”, “Ẳ”:”A”, “Ẵ”:”A”, “Ǎ”:”A”, “”:”A”, “Ấ”:”A”, “Ậ”:”A”, “Ầ”:”A”, “Ẩ”:”A”, “Ẫ”:”A”, “Ä”:”A”, “Ǟ”:”A”, “Ȧ”:”A”, “Ǡ”:”A”, “Ạ”:”A”, “Ȁ”:”A”, “À”:”A”, “Ả”:”A”, “Ȃ”:”A”, “Ā”:”A”, “Ą”:”A”, “Å”:”A”, “Ǻ”:”A”, “Ḁ”:”A”, “Ⱥ”:”A”, “Ô:”A”, “Ꜳ”:”AA”, “Æ”:”AE”, “Ǽ”:”AE”, “Ǣ”:”AE”, “Ꜵ”:”AO”, “Ꜷ”:”AU”, “Ꜹ”:”AV”, “Ꜻ”:”AV”, “Ꜽ”:”AY”, “Ḃ”:”B”, “Ḅ”:”B”, “Ɓ”:”B”, “Ḇ”:”B”, … Read more

What does ‘COLLATE SQL_Latin1_General_CP1_CI_AS’ do?

It sets how the database server sorts (compares pieces of text). in this case: SQL_Latin1_General_CP1_CI_AS breaks up into interesting parts: latin1 makes the server treat strings using charset latin 1, basically ascii CP1 stands for Code Page 1252 CI case insensitive comparisons so ‘ABC’ would equal ‘abc’ AS accent sensitive, so ‘ü’ does not equal … Read more

How to change the CHARACTER SET (and COLLATION) throughout a database?

change database collation: ALTER DATABASE <database_name> CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; change table collation: ALTER TABLE <table_name> CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; change column collation: ALTER TABLE <table_name> MODIFY <column_name> VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; What do the parts of utf8mb4_0900_ai_ci mean? 3 bytes — utf8 4 bytes — utf8mb4 (new) v4.0 … Read more

How to change the default collation of a table?

To change the default character set and collation of a table including those of existing columns (note the convert to clause): alter table <some_table> convert to character set utf8mb4 collate utf8mb4_unicode_ci; Edited the answer, thanks to the prompting of some comments: Should avoid recommending utf8. It’s almost never what you want, and often leads to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)