Emojis in SQL Server

12

September 15, 2016 by Kenneth Fisher

I blame Aaron Bertrand (b/t) and Kevin Kline (b/t). Aaron who posted a great #BackToBasics blog about naming stored procedures and Kevin who tweeted about it.

It’s not my fault. I had to be sarcastic. I had to mention the correct naming standard for stored procedures.

usp_DBAName_GUID_purpose_GUID2_createdate_VersionNumber

It’s certainly not my fault I made a flip comment about emoji’s in SQL Server. It’s entirly Aaron’s for showing me it could be done. But now I just have to use them.

Introducing my new comment block.

emoji-sql-server

I copied and pasted the emoji’s from here. Oh, and here is my new test database.

CREATE DATABASE [😺&🐯&🐻o🙋]

emojisql2

You can see how it’s all Aaron and Kevin’s fault right?
Edit:
Ok, this seemed like an important quick addition to this post:

dongerlist

¯\_(ツ)_/¯

12 thoughts on “Emojis in SQL Server

  1. thomasrushton says:

    Go on, what does sp_MSforeachDB make of that?

  2. Daivd says:

    You are one sick person.

    I can’t wait to mess with the developers. 🙂

  3. Chris Wood says:

    As this was SQL Sentry (Aaron) I would like to see what Plan Explorer would make of the execution plans.

  4. Honestly, from a testing POV, this convention should be adopted by the companies that make tools. If your tool doesn’t choke on those names, then it won’t choke on “lest robust” ones

  5. […] delimiters around it depending on what the name is. Identifiers with spaces, special characters or emojis require delimiters, otherwise it’s optional. If it does you will use square brackets ([]) or […]

  6. Hi Ken. While it is true that Emojis can be used (really it’s all but 2 Unicode characters), a caveat / note of caution needs to be added here: SQL Server Collations and non-versioned Windows Collations (well, version number not in the name, which implies version 80 / SQL Server 2000) assign no sort weights to any supplementary characters. Emojis are supplementary characters. This means that using them in one object name at a particular level is usually not an issue, but using multiples of them increases the chances of it becoming an issue since all names of a particular item need to be unique. So using 1 of them or 100 of them is the same as using none of them. They simply do not count in those two early sets of Collations, unless they are binary Collations. It is not until the version 90 Collations (those introduced with SQL Server 2005) were they given sort weights and could be distinguished from each other outside of binary collations. For examples and proof of this, please see the “Supplementary Characters” section of the following post:

    https://SqlQuantumLeap.com/2018/04/16/the-uni-code-the-search-for-the-true-list-of-valid-characters-for-t-sql-identifiers-part-3-of-2-delimited-identifiers/

    • That’s great information since I’m actually using them in on of my demo databases. As object names so it shouldn’t be as big a deal, but still. But honestly if I ever saw someone using emojis in anything but a “play” database I’d be seriously worried about them in general.

      • This isn’t just an issue for database names, it’s for anything. The difference is that server-level objects (Databases, Logins, tempdb meta-data, variable and cursor names, etc) are controlled by the Instance/Server Collation, while Database-level objects (Users, Schemas, Schema-bound objects, etc) are controlled by the Database’s default Collation. And given that we create more objects at the DB level than at the server level, it is actually more likely that you will have an issue with DB objects (but again, only if you are using Collations that pre-date the 90 series).

        Also, while emojis are the most fun / common to be dealing with (especially in examples like we have both given), there are a great many valid, non-emoji Supplementary Characters, even if they are infrequently used.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 2,469 other followers

Follow me on Twitter

ToadWorld Pro of the Month November 2013
%d bloggers like this: