问题
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?
回答1:
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."
- sql server 2008 not showing and inserting unicode characters
回答2:
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!
回答3:
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:
- Tools --> Options --> Environement --> Fonts and Colors. Select in
Show settings forthe optionGrid Resultsand for this option, use an unicode font. - Be sure that your table has the column with
nvarchar(X), notvarchar(X). Be sure that, when you insert data, you have
N characterbefore 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)
回答4:
There is no column called "value". Does this work?
UPDATE Table SET COLUMN_NAME = N'SUPPLY 9-30Vdc 0.2W ⎓' WHERE id = '1234'
来源:https://stackoverflow.com/questions/39881779/sql-server-2012-not-showing-unicode-character-in-results