CREATEprocedure sp_func
as begin createtable #tmpTable
(
/**//**/ )
declare curTable cursorfor -- open curTable
while1=1 begin fetchnextfrom curTable into-- if@@fetch_status<>0 break /**//**/ end close curTable
deallocate curTable
select*from #tmpTable
droptable #tmpTable
end go