Skip to content
Advertisement

Add emoji / emoticon to SQL Server table

I am trying to insert emoji / emoticons to a SQL Server database but it just stores ??? instead of the emoji / emoticons.

I am finding only help for SQL Server not MySQL.

I tried : link

but not finding answers even not able to set with :

SQL Server does not recognize this command. This is only for Microsoft SQL Server not MySQL

Advertisement

Answer

Use NVARCHAR(size) datatype and prefix string literal with N:

db<>fiddle demo

Output:


EDIT:

SQL Server 2019 and forward supports UTF-8 collation:

db<>fiddle demo – SQL Server 2019

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement