Problem with email addresses containing "@1"

I use email addresses as the entity name (to keep things unique).

I have recently noticed a problem with some of my scripts when I am working with an entity name that has an email address such as "" seems to be a popular email service / ISP in china

The problem is that when I run an sql.Query and pass through an EntityName variable (containing the @1 portion of this seem to be treated as an empty variable and therefore I don’t get the results I am expecting.

I have got around this by doing the following:
Note the replacement of the “@” symbol…

function getEntityFullNameFromName(EntityName) {
	EntityName = EntityName.replace("@","'+'@'+'");
	return sql.Query("SELECT jsonValue FROM ENTITIES CROSS APPLY OPENJSON(CustomData) WITH (jsonName	varchar(99) '$.Name', jsonValue varchar(99) '$.Value') jsonData WHERE jsonName = 'Full Name' and Name = '"+EntityName+"'").First;

But this seems a little messy and I was wondering if anyone has any tips on how I could do this better?

At the very least I thought I would just write this here in case anyone else faces a similar problem.

Haha, as if to illutrate how “@” symbols cause me problems, when trying to post this I got the following error!