Asaf
Asaf

Reputation: 91

Insert Cyrillic strings with stored procedure by parameter SQL Server

I have the following insert statement in a stored procedure:

INSERT INTO Persons (ID, Name, LocationID) 
VALUES (@MaxId, @Name, @LocationID)

It works fine until I get a name with Cyrillic characters (i.e дом), which added a record with name = ???

I know I can use something like that:

INSERT INTO Assembly 
VALUES(N'Македонски парлиамент број 1', '', '');

But how can I use it with SQL parameters?

Thanks

Upvotes: 0

Views: 497

Answers (1)

gotqn
gotqn

Reputation: 43636

Basically, you should check the followings:

  1. Is @Name variable with NVARCHAR type? If it is a VARCHAR type it cannot store properly your Cyrillic values.
  2. If you are setting the @Name value by yourself, check if there is N before the string value (as in your example)

Upvotes: 3

Related Questions