create function dbo.stripTrailing(@str varchar(8000),@trailing varchar(20))
returns varchar(8000)
as
begin
while @str like '%' + @trailing
set @str = left(@str,len(@str)-len(@trailing))
return @str
end
GO
select dbo.stripTrailing(strCol, '<br />') from tbl
|