|
Posted by MikeJ on 10/18/07 22:43
also instead of calling a function many times
create a function or a proct
Sample incomming string
declare @somestring varchar(100)
set @somestring = 'aaa bbb cccc eee fff f gggg h i aa '
--sample guts of function / proc
while charindex(' ',@somestring)>0 begin
set @Somestring = replace(@somestring,' ',' ')
end
print @somestring
---output aaa bbb cccc eee fff f gggg h i aa
"Blackburn" <blackburn@2centsediting.mypants.com> wrote in message
news:1192727141_459@sp12lax.superfeed.net...
> "Russ Rose" <russrose@hotmail.com> wrote:
>>
>
>
> How did you guys miss the recursion boat?
>
> Create function dbo.udf_CondenseSpaces (@str varchar(8000))
>
> Returns varchar(8000)
> AS
>
> BEGIN
> Declare @s varchar(8000)
>
> Set @s = replace(@str, ' ', ' ')
>
> if charindex(' ', @s) > 0
>
> set @s = dbo.udf_CondenseSpaces(@s)
>
> return @s
> END
[Back to original message]
|