Create function f_trimstr (@str varchar (100))
Returns varchar (100)
AS
Begin
Declare @i intDeclare @ s1 varchar (50) Declare @Result varchar (100) Declare @LEN INT
SELECT @Result = '' SELECT @Str = Ltrim (RTRIM (@str)) SELECT @LEN = LEN (@str) SELECT @i = 1
While @i <= @ lenbegin select @ S1 = Substring (@ Str, @ i, 1) IF (@ S1 <> ') begin select @Result = @Result @ S1 end select @i = @i 1nd
Return @Result
end
Replace ((@ Str, ',' ') is OK