删除指定字符前的所有内容
Create FUNCTION [dbo].[RemoveLeftCharMy]
(
@Expression varchar(max),
@char varchar(10)
)
RETURNS varchar(max)
AS
BEGIN
WHILE LEN(@Expression)>0 AND CHARINDEX(@char,@Expression)>1
BEGIN
if(CHARINDEX(@char,@Expression)>1)
begin
SET @Expression=SUBSTRING(@Expression,CHARINDEX(@char,@Expression),LEN(@Expression)-CHARINDEX(@char,@Expression))
end
if(CHARINDEX(@char,@Expression)=1)
begin
SET @Expression=@Expression
end
END
return @Expression
END