dbo.fun_SplitStr(@YPBZ,',')
CREATE function [dbo].[fun_SplitStr](@SourceSql varchar(8000), @StrSeprate varchar(100))
returns @temp table(F1 varchar(1000))
as
begin
declare @ch as varchar(1000)
set @SourceSql=@SourceSql+@StrSeprate
while(@SourceSql<>'')
begin
set @ch=ltrim(rtrim(left(@SourceSql,charindex(',',@SourceSql,1)-1)))
insert @temp values(@ch)
set @SourceSql=stuff(@SourceSql,1,charindex(',',@SourceSql,1),'')
end
return
end