I have created simple function
create function TRIM(@data varchar(20)) returns varchar(100)
as
begin
declare @str varchar(20)
set @str = rtrim(ltrim(@data))
return @str
end
I am executing in the below way.
declare @s varchar(25)
set @s = ' Amru '
select TRIM(@s)
I am getting the following error.
Msg 195, Level 15, State 10, Line 3
'TRIM' is not a recognized built-in function name.
Could any one please help me find the issue?
You need to use the Schema prefix when calling user defined functions. In your case this will most likely be “dbo”.
Change your select statement to: