Reputation: 3676
All I want to do is update a field with the DIRECT CURRENT SYMBOL FORM TWO ⎓
character into my SQL Server 2012 database. Is that too much to ask? Apparently it is.
The answer to this question and this question is the same and did not work for me.
My update script
UPDATE Table
SET Value = N'SUPPLY 9-30Vdc 0.2W ⎓'
WHERE id = '1234'
Aaaaand the relevant table schema:
CREATE TABLE [dbo].[Table]
(
...
...
[Value] [nvarchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
...
...
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Want more? Here's the results of sp_columns
:
Yes, I prefixed the string with N''. That should work, right? Nope.
Screenshot:
Notice the little box where the unicode character should be. Why, though?
Upvotes: 6
Views: 13798
Reputation: 2036
Thanks to @Aron, I was having next problem:
In SSMS, when I copy a text like Sighișoara
from a grid result (table A from database A) and paste in an insert query (table B from database B), the result of this insert was Sighi?oara
, with an interrogation character.
Steps that helped to me in SSMS:
Show settings for
the option Grid Results
and for this option, use an unicode font.nvarchar(X)
, not varchar(X)
.Be sure that, when you insert data, you have N character
before string, like this:
insert into table(a,b,c,d,e,f) values ('Rumania',N'Sighișoara',GETDATE(),0,0,'Test')
(For SSMS 17.9.1)
Upvotes: 3
Reputation: 775
Per the comment discussion on your question, your SQL code is correct and the unicode character is being updated, but SQL Server Management Studio cannot (for some reason) display this unicode character in the GRID resultset. If you change your result view to TEXT (control+T), you should see the unicode character.
"If you use SSMS for your queries, change to output type from "Grid" to "Text", because depending on the font the grid can't show unicode."
Upvotes: 8
Reputation: 5366
You can try:
UPDATE Table SET Value = 'N' + char(39) + 'SUPPLY 9-30Vdc 0.2W ⎓' WHERE id = '1234'
Maybe:
SET QUOTED_IDENTIFIER OFF;
UPDATE Table SET Value = REPLACE(Value, "N'SUPPLY ", "SUPPLY") WHERE id = '1234'
SET QUOTED_IDENTIFIER ON;
I hope this helps...
Good Luck!
Upvotes: 0
Reputation: 39
There is no column called "value". Does this work?
UPDATE Table SET COLUMN_NAME = N'SUPPLY 9-30Vdc 0.2W ⎓' WHERE id = '1234'
Upvotes: -1