Reputation: 6543
I have the following Stored Procedure, Im looking for the correct syntax so I can play the Comments Value in the Comments column with N in front end the value for Unicode I need save Russian Characters Values
So at the moment the comments value is being passed as such
@comments
I want to do
N@comments but not working
ALTER PROCEDURE [dbo].[spInsertContactUs]
(
@title VARCHAR(20) = default,
@forename VARCHAR(100) = default,
@surname VARCHAR(100) = default,
@gender VARCHAR(50) = default,
@address1 VARCHAR(100) = default,
@address2 VARCHAR(100) = default,
@city VARCHAR(50) = default,
@county VARCHAR(50) = default,
@country INT = default,
@zipcode VARCHAR(50) = default,
@email VARCHAR(200) = default,
@comments NVARCHAR(MAX) = default,
@mailinglist BIT = default,
@address3 VARCHAR(100) = default,
@dateOfBirth datetime = default
)
AS
SET NOCOUNT ON
INSERT INTO tblContactUs (
dateAdded,
title,
forename,
surname,
gender,
address1,
address2,
city,
county,
country,
zipcode,
email,
comments,
mailinglist,
address3,
dateOfBirth)
VALUES (
getdate(),
@title,
@forename,
@surname,
@gender,
@address1,
@address2,
@city,
@county,
@country,
@zipcode,
@email,
@comments,
@mailinglist,
@address3,
@dateOfBirth
)
SET NOCOUNT OFF
RETURN
;
Upvotes: 4
Views: 14353
Reputation: 1
This works. I figured it out myself:
Command.Parameters.Add("@prc", SqlDbType.NVarChar).Value = strPrc;
You need to change your SqlDbType into NVarChar. You also need to change the field into Nvarchar field and the stored procedure into that too.
Upvotes: 0
Reputation: 1
declare @a nvarchar(50)
set @a =N'تست'
exec('INSERT INTO [dbo].[tblP] ([productVal],[name],[month]) VALUES ( 9, '+'N'''+@a+''',1)')
INSERT INTO [dbo].[tblP] ([productVal],[year],[month]) VALUES ( 9, N'تست',1)
Upvotes: -1