日期:2014-05-17 浏览次数:20487 次
create function strfun2(@str1 nvarchar(100),@str nvarchar(100))
returns nvarchar(100)
as
begin
return case when charindex(@str1,@str)>0 then replace(@str,@str1,'') else @str end
end
go
select dbo.strfun2('1','321')
sstr=replace(sstr,'string1','')
CREATE FUNCTION strfun2(@source VARCHAR(100),@match VARCHAR(100))
RETURNS NVARCHAR(100)
AS
BEGIN
SELECT @source=replace(@source,@match,'')
RETURN @source;
END
SELECT dbo.strfun2('abcb','b')