MSSQL & Sybase:
//gxg8816,请指教,呵呵,我的第一个MSSQL Procedure
create procedure MySplit(@p_String varchar(100))
as
declare
@v_Char varchar(1)
@v_TempSubStr varchar(100)
@v_i int
@v_Length int
begin
select @v_Length=datalength(@p_String)
select @v_i=0
select @v_TempSubStr=' '
while @v_i<@v_Length
begin
select @v_i=@v_i+1
select @v_Char=substring(@p_String,v_i,1)
if @v_Char=','
begin
/* @v_TempSubStr就是你需要的Sub字符串 */
select @v_TempSubStr=' '
end
else
select @v_TempSubStr=Trim(@v_TempSubStr)+@v_Char
end
end
go