这游标的写法,久了没写就确实忘记格式了,老实点记录下来吧...
declare @Province varchar(50); declare @ProvinceCode varchar(50); declare myCursor cursor for (select distinct Province,ProvinceCode from t_PublicRegion) open myCursor fetch next from myCursor into @Province,@ProvinceCode while(@@FETCH_STATUS=0) begin print @Province+@ProvinceCode fetch next from myCursor into @Province,@ProvinceCode end close myCursor deallocate myCursor