mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
16 KiB
16 KiB
In [1]:
USE master;
GO
DROP DATABASE IF EXISTS MyNonUtf8Database;
DROP DATABASE IF EXISTS MyUtf8Database;
DROP DATABASE IF EXISTS MyFormerlyUnicodeOnlyDatabase;
DROP DATABASE IF EXISTS MaskingDatabase;Commands completed successfully.
Commands completed successfully.
Total execution time: 00:00:00.129
In [2]:
CREATE DATABASE MyNonUtf8Database COLLATE SQL_Latin1_General_CP1_CI_AI;
GO
USE MyNonUtf8Database;
GO
CREATE TABLE MyUtf8Table (datakind VARCHAR(100), data VARCHAR(8000) COLLATE Latin1_General_100_CI_AS_SC_UTF8);
GO
INSERT INTO MyUtf8Table
VALUES ('ASCII - 1 byte per character', N'Thequickbrownfoxjumpsoverthelazydog'),
('Cyrillic - 2 bytes per character', N'Быстраякоричневаялисапрыгаетчерезленивуюсобаку'),
('Far East - 3 bytes per character', N'敏捷的棕色狐狸跳过了懒狗'),
('Emojis - 4 bytes per character', N'👶👦👧👨👩👴👵👨👩👨👩👨👩👨👩'),
('Emojis with Variation Selector - 6 bytes per glyph', N'⚕️⚖️↔︎↕︎↖︎↗︎↘︎↙︎↩︎↪︎↔️↕️↖️↗️↘️↙️↩️↪️'),
('Ashi with Supplementary Variation Selector - 7 bytes per glyph', N'芦󠄀芦󠄁芦󠄂芦󠄃芦󠄄芦󠄅芦󠄆芦󠄇芦󠄈芦󠄉芦󠄃芦󠄂芦󠄁芦󠄀芦󠄁芦󠄂芦󠄃芦󠄄芦󠄈芦󠄉');
GO
SELECT datakind, data
FROM MyUtf8Table;
GOOut [2]:
Commands completed successfully.
Commands completed successfully.
Commands completed successfully.
(6 rows affected)
(6 rows affected)
Total execution time: 00:00:00.597
| datakind | data |
|---|---|
| ASCII - 1 byte per character | Thequickbrownfoxjumpsoverthelazydog |
| Cyrillic - 2 bytes per character | Быстраякоричневаялисапрыгаетчерезленивуюсобаку |
| Far East - 3 bytes per character | 敏捷的棕色狐狸跳过了懒狗 |
| Emojis - 4 bytes per character | 👶👦👧👨👩👴👵👨👩👨👩👨👩👨👩 |
| Emojis with Variation Selector - 6 bytes per glyph | ⚕️⚖️↔︎↕︎↖︎↗︎↘︎↙︎↩︎↪︎↔️↕️↖️↗️↘️↙️↩️↪️ |
| Ashi with Supplementary Variation Selector - 7 bytes per glyph | 芦󠄀芦󠄁芦󠄂芦󠄃芦󠄄芦󠄅芦󠄆芦󠄇芦󠄈芦󠄉芦󠄃芦󠄂芦󠄁芦󠄀芦󠄁芦󠄂芦󠄃芦󠄄芦󠄈芦󠄉 |
In [1]:
CREATE DATABASE MyUtf8Database COLLATE Lithuanian_100_CS_AI_WS_SC_UTF8;
GO
USE MyUtf8Database;
GO
CREATE TABLE MyTableWithInheritedCollation (datakind VARCHAR(100), data VARCHAR(8000));
GO
INSERT INTO MyTableWithInheritedCollation
VALUES ('ASCII - 1 byte per character', 'Thequickbrownfoxjumpsoverthelazydog'),
('Cyrillic - 2 bytes per character', 'Быстраякоричневаялисапрыгаетчерезленивуюсобаку'),
('Far East - 3 bytes per character', '敏捷的棕色狐狸跳过了懒狗'),
('Emojis - 4 bytes per character', '👶👦👧👨👩👴👵👨👩👨👩👨👩👨👩'),
('Emojis with Variation Selector - 6 bytes per glyph', '⚕️⚖️↔︎↕︎↖︎↗︎↘︎↙︎↩︎↪︎↔️↕️↖️↗️↘️↙️↩️↪️'),
('Ashi with Supplementary Variation Selector - 7 bytes per glyph', '芦󠄀芦󠄁芦󠄂芦󠄃芦󠄄芦󠄅芦󠄆芦󠄇芦󠄈芦󠄉芦󠄃芦󠄂芦󠄁芦󠄀芦󠄁芦󠄂芦󠄃芦󠄄芦󠄈芦󠄉');
GO
SELECT datakind, data
FROM MyTableWithInheritedCollation;
GOOut [1]:
Commands completed successfully.
Commands completed successfully.
Commands completed successfully.
(6 rows affected)
(6 rows affected)
Total execution time: 00:00:00.424
| datakind | data |
|---|---|
| ASCII - 1 byte per character | Thequickbrownfoxjumpsoverthelazydog |
| Cyrillic - 2 bytes per character | Быстраякоричневаялисапрыгаетчерезленивуюсобаку |
| Far East - 3 bytes per character | 敏捷的棕色狐狸跳过了懒狗 |
| Emojis - 4 bytes per character | 👶👦👧👨👩👴👵👨👩👨👩👨👩👨👩 |
| Emojis with Variation Selector - 6 bytes per glyph | ⚕️⚖️↔︎↕︎↖︎↗︎↘︎↙︎↩︎↪︎↔️↕️↖️↗️↘️↙️↩️↪️ |
| Ashi with Supplementary Variation Selector - 7 bytes per glyph | 芦󠄀芦󠄁芦󠄂芦󠄃芦󠄄芦󠄅芦󠄆芦󠄇芦󠄈芦󠄉芦󠄃芦󠄂芦󠄁芦󠄀芦󠄁芦󠄂芦󠄃芦󠄄芦󠄈芦󠄉 |