Is there something special I need to do to be able to save some Hebrew text in my table? I have the column set as nvarchar(max) yet when i do something like this
It returns
ScriptIDLanguageIDSectionIDScriptText
671113?????? ??? ?? ??????, ???? ???
your query did not appear, but i suspect it has to do with implicit conversions.
you have to use the N'' denotation to make sure SQL knows it is nvarchar data.
here is a very simple example; the first returns question marks, the second the expected characters.
SELECT '??????','??' --SELECT Database,AnimalName in Japanese
SELECT N'??????',N'??' --SELECT Database,AnimalName in Japanese
Lowell
October 9, 2019 at 5:06 pm
ok the forum converts to varchar as well! so my nvarchar string characters got converted to question marks!
Lowell
October 9, 2019 at 5:07 pm
Is there something special I need to do to be able to save some Hebrew text in my table? I have the column set as nvarchar(max) yet when i do something like this
It returns
ScriptIDLanguageIDSectionIDScriptText
671113?????? ??? ?? ??????, ???? ???
It might be a diplay issue, or maybe you're not saving it correctly. I can't say because you added your query as an image that can't be seen instead of copying and pasting the code.
Here's an example that worked correctly.
CREATE TABLE #SampleData(
SomeText NVARCHAR(MAX));
INSERT INTO #SampleData
VALUES( N'??? ??????? ?????');
SELECT * FROM #SampleData;
DROP TABLE #SampleData;
October 9, 2019 at 5:10 pm
Thank you. I saw that it changed it to varchar and edited my original post to be an image of my query
October 9, 2019 at 5:14 pm
Now I see the problem and the reason behind the image that I can see now.
Here's the image of the example.
October 9, 2019 at 5:22 pm
Do I need to make any changes when it is saved via SPROC?
Here is the Current SPROC
ALTER PROCEDURE [dbo].[AddButtons]
@LanguageID int,
@ButtonText nvarchar(200),
@ButtonID int
AS
SET NOCOUNT ON
IF EXISTS (SELECT ButtonText FROM dbo.Buttons WHERE LanguageID = @LanguageID AND ButtonID = @ButtonID)
BEGIN
UPDATE
dbo.Buttons
SET
ButtonText = @ButtonText
WHERE
LanguageID = @LanguageID
AND ButtonID = @ButtonID
END
ELSE
BEGIN
INSERT
dbo.Buttons
VALUES
(
@LanguageID,
@ButtonText,
@ButtonID
)
END
I ask because I was using ADO.NET cmd.Parameters.AddWithValue method without first defining the SqlDbType and it saved as varchar i.e. the question marks
Once I changed the code to use the add method and then defined as SqlDbType.NVarChar it worked.
October 9, 2019 at 6:16 pm
Here's an article addressing your problem when using AddWithValue.
https://blogs.msmvps.com/jcoehoorn/blog/2014/05/12/can-we-stop-using-addwithvalue-already/
October 9, 2019 at 7:07 pm
Thank you Luis! I must not be wording my Google Queries properly because after I did a few searches I could not find anything on that that provided a lick of information to me.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply