createprocedure dbo.communityAndWish as set nocount on declare@param1varchar(20),@param2varchar(20),@indexint set@index=1 createtable #temptb1( ecardId int , spaceName varchar(50) ) declare cur1 cursorforselect ecardId from ecard declare cur2 cursorforselect spaceName from community open cur1 open cur2 fetch cur2 into@param2 fetch cur1 into@param1 while@@FETCH_STATUS=0 begin insertinto #temptb1(ecardId,spaceName) values(@param1,@param2) fetchnextfrom cur1 into@param1 fetchnextfrom cur2 into@param2 end close cur1 close cur2 deallocate cur1 deallocate cur2 select*from #temptb1 droptable #temptb1 go execute dbo.communityAndWish dropprocedure communityAndWish