views:

55

answers:

3

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 ?????

+1  A: 

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

David M
A: 

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

SQLMenace
+1  A: 

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.

Thomas
you got it. trim function was returning varchar instead of nvarchar. Thanks
Sharique