David542
David542

Reputation: 110592

SQL Server collation -- closest to utf-8?

I can't seem to find a way to set the default collation of a database to utf(ish). For example:

enter image description here

For example, in mysql the default utf collation is called utf8_general_ci. Is there something similar for SQL server for this? Also, what does it use Latin1 as default?

Upvotes: 2

Views: 7155

Answers (1)

Randy in Marin
Randy in Marin

Reputation: 1143

According to https://learn.microsoft.com/en-us/sql/relational-databases/collations/collation-and-unicode-support?view=sql-server-ver15#utf8, you add "_UTF8" to the collation name to enable use of UTF8. (SQL Server 2019 is required.) The example given is to change LATIN1_GENERAL_100_CI_AS_SC to LATIN1_GENERAL_100_CI_AS_SC_UTF8.

If you will be migrating an existing database from a older version, I believe extra care is required to insure collation conversion is handled properly. There can be side effects from the change in sorting. Also, existing table definitions will use their original collation. This might be an issue if creating new tables that will use the new collation by default.

Upvotes: 4

Related Questions