I answer every email I receive in six hours and that is why sometimes I end up working over 18 hours in a day. However, sometimes I receive emails such that makes me wonder, how come I do not know some very simple stuff. Here is for example – today I received email where user asked how to INSERT or SELECT Copyright Special Characters in SQL Server. Trust me, in my early career, I used to know the answer to this, but I was not able to answer the user immediately. After quick googling, I was able to find out the appropriate character string.
Here is the character set which is appropriate to generate special character.
To generate © type ALT + 0169
To generate ® type ALT + 0174
To generate ™ type ALT + 0153
Well, that is it, you use above characters in your html or SQL Editor in SQL Server Management Studio and you would be able to generate those special characters.
Here is the link to all the special characters which can be generated with ALT Keyboard Sequences.
NOTE: I received a follow up question by a user who was not able to go find an ALT key on the keyboard. Here is a hint, the two keys which are besides your longest key (space-bar) with ALT mentioned on it, is the ALT key. Apple keyboards use the option key in place of the ALT key.
Reference: Pinal Dave (https://blog.sqlauthority.com)
I prefer to get the actual value and to store one if needed using the following script as the base:
declare @i int = 128
while @i < 256 begin
if @i < 161
print cast(@i as varchar(25)) + ': ' + char(@i)
print cast(@i as nvarchar(25)) + ': ' + nchar(@i)
set @i += 1
SELECT ‘String 1 ‘ + CHAR(153) + ‘ String 2’
UNION ALL SELECT ‘String 1 ‘ + CHAR(169) + ‘ String 2’
UNION ALL SELECT ‘String 1 ‘ + CHAR(174) + ‘ String 2’;
I tried this but it works only with keys on num pad, but not the number keys underneath F keys.
Just to add, Not only these three special characters, we can insert whatever the special character into table by copying it from ‘Charmap’ (Windows Key + R, type ‘charmap’ to open)
I tried it but ™ – ALT + 0153 is not working at my end in SSMS rest all works. Any help plz ?
Can someone assist me on how I can insert these trademarks in MSSQL 2016 table having column as nvarchar using bulk insert ?
I tried UTF-8 and cp1252