'TRIM' is not a recognized built-in function name

Viewed 78298

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?

5 Answers
Related