83
Views
8
Comments
Solved
stored procedure update saves Arabic characters as question marks
Application Type
Reactive

Hello everyone,

 I am facing an issue where when I pass Arabic words into my stored procedure it'll updated the correct record but in the database instead of saving the string I passed in saves "????"  I'm assuming tis is because its a unicode string 

My first instinct was to use N' but it did not work in outsystems sql query because of the ' 

thanks!

UserImage.jpg
Rima Sadhan
Solution

The solution was to enable the expand inline property for the parameter in AdvanceSQL then passing the input as

"N'"+EncodeSql(MyArabicVariable)+"'"
2020-09-21 11-35-56
Sachin Waghmare

Hi Rima,

Please refer the below link to get the idea how you can pass the single quote string into the SQL query.

https://www.databasestar.com/sql-escape-single-quote/

Thanks & Kind Regards,

Sachin

UserImage.jpg
Rima Sadhan

I don't think this is  the issue because I'm passing a variable and I tried to concatenate the N' with the value before passing it to my sql query but it saved as "N'?????"

2020-09-21 11-35-56
Sachin Waghmare

Please refer these 2 links where it is mentioned that columns/attributes need to able to store unicode characters. I hope this will make sense and might be other members put some shed on this.

https://www.xspdf.com/resolution/55058141.html

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/419416c5-d1a1-4037-a5f3-0e815fa6277b/questions-mark-instead-of-data?forum=transactsql

Thanks & Kind Regards,

Sachin

2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Hi Rima,

Stored procedures are not part of the OutSystems Platform, so this doesn't seem like an OutSystems-related question?

That said, when question marks are saved, the database likely isn't configure for Unicode (unfortunately, the same goes for this forum: ??? (those were the Arabic numerals 1-3).

UserImage.jpg
Rima Sadhan

Hi killian, 

the data base already has a bunch of Arabic data that is why I assumed that the issue might be how I'm calling the stored procedure from outsystems or how I am passing the variables 

Thanks anyways! 

2021-01-19 14-07-32
Tom Zhao

Hi Rima,

Please tell us how did you call the stored procedure and passed the variables.

Also, Did you tried instead of calling the stored procedure using a simple update query ( pass the same parameter).

and see if you get the same results?

Kind Regards

UserImage.jpg
Rima Sadhan

Hello Tom,

Unfortunately, I cannot use a simple SQL query since I don't have the permission to edit the tables directly.

Here is how I call my Stored procedure in Outsystems.

/* %LogicalDatabase%=GetLogicalDatabase({user}) */
USE  [DBname]
EXEC [dbo].[sp_update_user] 
    @IdNumber,
    @FirstName,
    @LastName,
    @Gender,
    @IsActive
UserImage.jpg
Rima Sadhan
Solution

The solution was to enable the expand inline property for the parameter in AdvanceSQL then passing the input as

"N'"+EncodeSql(MyArabicVariable)+"'"
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.