Foreign character parameter not being executed by SQL 2005 stored procedure as expected

Hi folks,

I have a classic ASP page that passes parameters to a stored procedure in SQL 2005.  It's working well except for when the parameter contains foreign characters.

Profiler indicates the stored procedure is being called correctly:
exec mydb.dbo.sp_mysp N'',N'',N'>A:20',N'',N'',N''

Yet no records are returned.  When I do a stored procedure trace, I see that the parameter with foreign characters is changed to several question marks :
address like N'%??????%'
                                                   OR country like N'%??????%'
                                                   OR city like N'%??????%'
                                                   OR state like N'%??????%'
                                                   OR zip like N'%??????%')

Any suggestions?
LVL 1
hennessymAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
does the procedure parameters have NVARCHAR instead of VARCHAR data types?
0
hennessymAuthor Commented:
Yes, all the parameters are nvarchar.
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you will need to specify the Reponse.CodePage, if I remember correctly:
http://www.asp-dev.com/main.asp?page=96
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hennessymAuthor Commented:
Thanks, angelll.  I should have mentioned in my question that I do have the Response.CodePage to no avail.

Response.CodePage = 65001
Response.CharSet = "utf-8"

I think the problem is on the SQL side of things, as profiler indicates the value of the foreign character parameter is also changed to a bunch of question marks when executed from SSMS.

So,

exec mydb.dbo.mysp N'',N'',N'MyForeignChars',N'',N'',N''

is executed as:
address like N'%??????%'
                                                   OR country like N'%??????%'
                                                   OR city like N'%??????%'
                                                   OR state like N'%??????%'
                                                   OR zip like N'%??????%'
0
hennessymAuthor Commented:
Aargh, the answer hit me like a ton of bricks.  I foolishly had my @strSQL variable that's building the strings declared as a varchar instead of a nvarchar.

I'm still giving you the points angell, as your response was right-on given the information I gave you to work with.

Thanks again!

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.