How can I insert Arabic characters into a SQL Server database? I tried to insert Arabic data into a table and the Arabic characters in the insert script were inserted as '??????'
in the table.
I tried to directly paste the data into the table through SQL Server Management Studio and the Arabic characters was successfully and accurately inserted.
I looked around for resolutions for this problems and some threads suggested changing the datatype to nvarchar
instead of varchar
. I tried this as well but without any luck.
How can we insert Arabic characters into SQL Server database?
In SQL Developer go to Tools / Preferences / Environment / Encoding and select UTF-8 . Set an Environment Variable to NLS_LANG=ARABIC_AMERICA. AL32UTF8 or similar, you can also do NLS_LANG=. AL32UTF8 in order to keep default/existing language and territory.
The simplest solution is to insert data in table as NVARCHAR data type, like below. Show activity on this post. @DipGirase - You should be able to mix unicode characters from any language, for example insert into MyTable(MyColumn) values (N'हैलो दुनिया english АВГДЄЅЗИѲ àèìòù') .
The rules for naming database objects (such as tables, columns, views, and database procedures) are as follows: Names can contain only alphanumeric characters and must begin with an alphabetic character or an underscore (_). Database names must begin with an alphabetic character, and cannot begin with an underscore.
For the field to be able to store unicode characters, you have to use the type nvarchar
(or other similar like ntext
, nchar
).
To insert the unicode characters in the database you have to send the text as unicode by using a parameter type like nvarchar
/ SqlDbType.NVarChar
.
(For completeness: if you are creating SQL dynamically (against common advice), you put an N before a string literal to make it unicode. For example: insert into table (name) values (N'Pavan')
.)
Guess the solation is first turn on the field to ntext
then write N
with the value. For example
insert into eng(Name) values(N'حسن')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With