Error with emojis in column aliases

Matthew McCord 0 Reputation points

I'm having a problem in SQL server when using emojis in column aliases:

with [cte] AS (
NULL AS [πŸ•]
,NULL AS [πŸ•πŸ€’]
SELECT [πŸ•] FROM [cte]

Msg 8156, Level 16, State 1, Line 1
The column 'πŸ•πŸ€’' was specified multiple times for 'cte'.

Completion time: 2023-03-13T08:44:20.3825178-04:00

Certain emojis work as expected. This query executes successfully:

with [cte] AS (
NULL AS [πŸ•]
,NULL AS [πŸ•β€]
SELECT [πŸ•], [πŸ•β€] FROM [cte]

Tested on SQL Server up to version 2022: 16.0.1000.6

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
9,037 questions
No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 27,051 Reputation points

    And what could that be good for?

    Anyway, see Rules for Regular Identifiers, emoji's are not allowed in object/column names.

  2. Matthew McCord 0 Reputation points

    Changing DB collation from SQL_Latin1_General_CP1_CI_AS to Latin1_General_100_CI_AS_SC resolved this issue.