SQL Server游标循环读取
declare @DJBH varchar(50) declare @DM2 varchar(50) declare @SQLText varchar(3000) declare myCursor cursor for select top 10 DJBH from SPJHD ORDER BY DJBH open myCursor fetch next from myCursor into @DJBH while @@fetch_status=0 begin print 'CategoryId='+cast(@DJBH as varchar(20)) Set @SQLText = 'Select DM2 From SPJHD Where DJBH=' + ''''+@DJBH+'''' print @SQLText fetch next from myCursor into @DJBH end close myCursor deallocate myCursor SELECT * FROM SPJHD
记录Coding学习过程中的点点滴滴,记性不好,特别需要这么一个博客 逸'Coding'Blog