Note the N before values in insert statement above. If you do not mention it, system will treat the values as Varchar, not NVarchar.
SELECT * FROM #test
Returns
col1 col2 col3
------------------------------ ------------------------------ ------------------------------
?? ????? ??????? لا أتكلم العربية لا أتكلم العربية
To see a list of Arabic collations use
SELECT name, description
FROM fn_helpcollations()
WHERE name LIKE 'Arabic%'
This is helpful but work here's what works for me in all cases
ALTER DATABASE [database] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE [database] COLLATE ARABIC_CI_AS;
GO
ALTER DATABASE [database] SET MULTI_USER;
GO
Update: eventually I have to change datatype varchar to nvarchar in my project
9条答案
按热度按时间qgelzfjb1#
You need to choose an Arabic collation for your varchar/char columns or use Unicode (nchar/nvarchar)
Note the N before values in insert statement above. If you do not mention it, system will treat the values as Varchar, not NVarchar.
Returns
To see a list of Arabic collations use
nhjlsmyf2#
All of what you have to do is to make sure that
the
column Data type
isnvarchar()
after that I inserted Arabic with no problems
w1e3prcc3#
You can change the collation on the database level instead of changing for each column in the database:
5uzkadbs4#
insert into table (column) values (N'xxx').)
You should put N before string to make it unicode
h6my8fg25#
Add 'N' before every value. example:
rkue9o1l6#
Try using this:
the column Data type is
nvarchar()
zi8p0yeb7#
This is helpful but work here's what works for me in all cases
Update: eventually I have to change datatype varchar to nvarchar in my project
q5iwbnjs8#
make sure all your tables and
varchar
columns have the collation ofutf8_general_ci
e7arh2l69#
Iti is easy to store Arabic string in Oracle. Use this code:
The above will save in Oracle just fine.