Gunakan NVARCHAR(size)
tipe data dan awalan string literal dengan N
:
CREATE TABLE #tab(col NVARCHAR(100));
INSERT INTO #tab(col) VALUES (N'👍 🖒 🖓 🖕 🗑 🛦 ⁉ 😎 😔 😇 😥 😴 😭');
SELECT *
FROM #tab;
Keluaran:
╔═════════════════════════════════╗
║ col ║
╠═════════════════════════════════╣
║ 👍 🖒 🖓 🖕 🗑 🛦 ⁉ 😎 😔 😇 😥 😴😭 ║
╚═════════════════════════════════╝
EDIT:
SQL Server 2019 dan seterusnya mendukung UTF-8 susunan:
CREATE TABLE t(col VARCHAR(100) COLLATE Latin1_General_100_CI_AI_SC_UTF8);
-- column's data type is VARCHAR!
-- collate could be set on column/database/instance level
INSERT INTO t(col) VALUES (N'☢️');
SELECT * FROM t;
-- col
-- ☢️
db<>demo biola - SQL Server 2019