Reputation:
I am trying to store Arabic-strings in my database. it is working fine by using COLLATE Arabic_CI_AI_KS_WS
but some of Arabic records are missing some Arabic-alphabets. i have tried with some other sollate with but result as same. how to fix it ?
table structure :
CREATE TABLE [dbo].[Ayyat_Translation_Language_old_20131209] (
[Ayat_Translation_Language_ID] INT IDENTITY (1, 1) NOT NULL,
[Translation_Laanguage_ID] INT NULL,
[Juz_ID] INT NULL,
[Surah_ID] INT NOT NULL,
[Ayat_Description] VARCHAR (2000) COLLATE Arabic_CI_AI_KS_WS NOT NULL
)
insertion code :
string query = "insert into Ayyat_Translation_Language_old_20131209 values(null,null," + surah + ",N'" + verse + "')"; where verse contains Arabic contents.
and it stores data like this (with question-marks) :
?بِسْمِ اللَّهِ الرَّحْمَ?نِ الرَّحِيمِ
i have read that link : store arabic in SQL database
Upvotes: 4
Views: 9379
Reputation: 15327
All of what you have to do is to make sure that
the column Data type
is nvarchar()
after that I inserted Arabic with no problems even with Tashkeel
this in SQl server management studio 2012
Upvotes: 3
Reputation: 300549
To store unicode string data, use NVARCHAR(2000)
rather than VARCHAR(2000)
for column [Ayat_Description]
Ref.: nchar and nvarchar
Upvotes: 7
Reputation: 7189
use arabic collation
or use unicode(nvarchar(max))
This is a Example table For your answer :
CREATE TABLE #t11
(
column1 NVARCHAR(100)
)
INSERT INTO #t11 VALUES(N'لا أتكلم العربية')
SELECT * FROM #t11
Upvotes: 0
Reputation: 13484
It may help
CREATE TABLE [dbo].[Ayyat_Translation_Language_old_20131209] (
[Ayat_Translation_Language_ID] INT IDENTITY (1, 1) NOT NULL,
[Translation_Laanguage_ID] INT NULL,
[Juz_ID] INT NULL,
[Surah_ID] INT NOT NULL,
[Ayat_Description] NVARCHAR (2000) COLLATE Arabic_CI_AI_KS_WS NOT NULL
Upvotes: 1