set @depts = @depts + ','
while charindex(',',@depts) > 0 
Begin   
    set @dept=left(@depts,charindex(',',@depts)-1)
    insert into @DEPTTAB(deptid)
    select @dept
    set @depts = substring(@depts,charindex(',',@depts)+1,len(@depts) - charindex(',',@depts))   
end

posted on 2010-02-04 14:46  qinghao  阅读(120)  评论(0编辑  收藏  举报

Copyright © 2009 qinghao Powered by: 博客园