TransUnicodeToUTF8 compresses the specified Unicode character data into UTF8 format, and returns the compressed result. This is useful when the input data is predominantly Latin characters because UTF8 uses one byte to represent Latin characters and Unicode uses 2 bytes.
TransUnicodeToUTF8 provides good compression for Unicode strings of any length and is best used:
- On a Unicode column that contains mostly US-ASCII characters
- When the data frequently switches between:
- Uppercase and lowercase letters
- Digits and letters
- Latin and non-Latin characters
- When the data is very dynamic (under frequent update)
Although you can call the function directly, TransUnicodeToUTF8 is normally used with algorithmic compression (ALC) to compress table columns. If TransUnicodeToUTF8 is used with ALC, nulls are also compressed if those columns are nullable.