日期:2014-05-17 浏览次数:20671 次
declare @col1 varchar(50)
declare cursor1 cursor for
select col1 from tb
open cursor1
fetch next from cursor1 into @col1
while @@fetch_status=0
begin
if @col1='a' exec sp1
else if @col1='b' exec sp2
else if @col1='c' exec sp3
else if @col1='d' exec sp4
else exec sp5
fetch next from cursor1 into @col1
end
close cursor1
deallocate cursor1