|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 12:24 PM
Points: 162,
Visits: 375
|
|
I need to store information with occasional Greek characters. My SELECT CONVERT (nvarchar, SERVERPROPERTY('collation')) is SQL_Latin1_General_CP1_CI_AS
Test script:
create table test1 (title nvarchar(200) INSERT INTO test1 (title ) VALUES ('FcεRI-mediated activity' ) select * from test1
converts the third character from epsilon to "e"
How can I store unicode data correctly?
Thank you for assistance.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, January 06, 2011 10:38 AM
Points: 182,
Visits: 191
|
|
Alter the table as the following to support the Greek character.
ALTER TABLE test1 ALTER COLUMN title nvarchar(200) COLLATE greek_ci_as
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 12:24 PM
Points: 162,
Visits: 375
|
|
Thank you, but it did not work.
Is there a database-level collation that might be effecting this?
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 12:24 PM
Points: 162,
Visits: 375
|
|
This worked:
create table test1 (title nvarchar(200) COLLATE greek_ci_as) INSERT INTO test1 (title) VALUES (N'FcεRI-mediated activity') select * from test1
The "alter" works for columns already present.
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 12:24 PM
Points: 162,
Visits: 375
|
|
The collate change was unnecessary. Not having to change collation makes testing a large application much simpler.
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 10:07 AM
Points: 2,802,
Visits: 7,107
|
|
You won't need to change the collation at all.
The reason it is not storing unicode is because you are not passing the string as Unicode.
add the leading unicode N before your string and this will work.
eg
INSERT INTO [test1] ( [title] ) VALUES (N'FcεRI-mediated activity' )
|
|
|
|