Sharique
Sharique

Reputation: 4219

collation in stored procedure

I have a table which contains data in different languages. All fields are nvarchar(max). I created a stored procedure which trim values of all the fields

Create Proc [dbo].[TrimValues]
as
update testdata 
set city = dbo.trim(city),
state = dbo.trim(state),
country = dbo.trim(country),
schoolname = dbo.trim(schoolname)

after trim all non-english text become ?????

Upvotes: 2

Views: 378

Answers (3)

Thomas
Thomas

Reputation: 64645

Either the parameter to your Trim user-defined function is declared as varchar instead of nvarchar or you are using a variable declared as varchar in that function to build the results or you have declared the results to be varchar instead of nvarchar. We'd need to see the source of the Trim function to know for sure.

Upvotes: 1

SQLMenace
SQLMenace

Reputation: 135021

make sure that you trim functions accepts nvarchar and not just varchar otherwise it will do an implicit conversion, can you post the code

Upvotes: 0

David M
David M

Reputation: 72880

Something wrong with your dbo.trim user-defined function then I'm guessing. Do you have the source for it?

Upvotes: 1

Related Questions