去掉字符串中的所有空格
CREATE Function f_trimstr(@str varchar(100))
returns varchar(100)
AS
begin
declare @i int
declare @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<=@len
begin
select @s1 = substring(@str,@i,1)
if(@s1<>'')
begin
select @result = @result + @s1
end
select @i = @i + 1
end
return @result
end