— =============================================
— Author: zoser
— Create date: 2009-01-14
— Description: SQL存储过程实现C#split的功能
— =============================================
alter PROCEDURE pro_SQLSplit
— Add the parameters for the stored procedure here
@SoureSql varchar(4000),—-源字符串
@SeprateStr varchar(10) —–分隔符
AS
BEGIN
declare @i int
declare @tmp float
set @tmp=0
set @SoureSql=rtrim(ltrim(@SoureSql))
set @i=charindex(@SeprateStr,@SoureSql)
while @i>1
begin
set @tmp = @tmp + convert(float,(left(@SoureSql,@i-1)))
set @SoureSql = substring(@SoureSql,@i+1,(len(@SoureSql)-@i))
set @i = charindex(@SeprateStr,@SoureSql)
end
select @tmp
END
GO
=============
—by: project—MedInformation—–