The execute function is not taking the arabic chars in..or nvarchars in
what i did is execute(@.sql)
where @.sql is a nvarchar
Assuming it as a insert statement to a table the chars are appearing as ?
where as the chars when inserted using a plain insert query comes clearly in arabic
set @.sql=insert into test values('arabic chars');
insert into test values('arabic chars'); works good plainly
but when called through execute it flops
execute (@.sql)
I even tried by inserting the @.sql value to the DB the query formed is shown that it is in arabic.
i tried using this but syntax error occured
EXECUTE sp_executesql @.stmt =N' (@.sqls)',
@.Farms = N'@.sqls nvarchar(max)',
@.sqls = @.strintest
The above is working only when we give the query
with dynamic values to be passed in
You have to ensure the value string shoule be prefixed with N.
(example) all the quires are working properly..
Code Snippet
insert Into testarabic values(N'???? ????? ??????? ???? ??? ???? ?????. ????? ?????? ?? ?????? ?? ???? ??????')
Exec ('insert Into testarabic values(N''???? ????? ??????? ???? ??? ???? ?????. ????? ?????? ?? ?????? ?? ???? ??????'')')
Declare @.SQL as NVarchar(1000);
Select @.SQL=N'insert Into testarabic values(N''???? ????? ??????? ???? ??? ???? ?????. ????? ?????? ?? ?????? ?? ???? ??????'')'
Exec (@.SQL)
The following quires will fail,
Code Snippet
insert Into testarabic values('???? ????? ??????? ???? ??? ???? ?????. ????? ?????? ?? ?????? ?? ???? ??????')
Exec ('insert Into testarabic values(''???? ????? ??????? ???? ??? ???? ?????. ????? ?????? ?? ?????? ?? ???? ??????'')')
Declare @.SQL as Varchar(1000);
Select @.SQL=N'insert Into testarabic values(N''???? ????? ??????? ???? ??? ???? ?????. ????? ?????? ?? ?????? ?? ???? ??????'')'
Exec(@.SQL)
No comments:
Post a Comment