| Author |
Topic |
|
velnias2010
Posting Yak Master
125 Posts |
Posted - 2010-08-13 : 09:33:42
|
| I have a stored procedure as followsALTER 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)ASSET 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 OFFRETURN;Now where I insert Comments I want to put N in front of that to cater for entering russian charactersi.e as UPDATE texts SET title = N'" + TextBoxRU.Text + "Cheers |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-08-13 : 09:51:33
|
| Use Nvarchar for @parameter instead of Varcharor CONVERT(Nvarchar(999), TextBoxRU.Text)but if TextBoxRU.Text is not already Nvarchar you will have lost the extended character information. |
 |
|
|
velnias2010
Posting Yak Master
125 Posts |
Posted - 2010-08-13 : 09:56:08
|
| Hey Kristen that SQL statement was just an example, if the Stored Procedure above I have the issue with.I.e I dont konw how to add N to the @comments line in my SP. You can see also I do declare comments as NVARCHAR@comments NVARCHAR(MAX) = default,Basically this worksN'SomeRussian'N@commentsDoesnt, how can I get around this ? |
 |
|
|
velnias2010
Posting Yak Master
125 Posts |
Posted - 2010-08-13 : 10:45:56
|
| I just tried the followingALTER 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)ASSET 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, CONVERT(Nvarchar(999), @comments), @mailinglist, @address3, @dateOfBirth )SET NOCOUNT OFFRETURN;But no joy the value entered was '?????' but saved as '�дмин' |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-08-15 : 07:41:51
|
When you are calling your SP then how you are giving the parameters?You should call the SP with N'?????' instead of '?????' for parameter @comments. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|