DECLARE @CurCode NVARCHAR(36); DECLARE MyCur CURSOR FOR SELECT [ID] FROM [Table]; OPEN MyCur; FETCH NEXT FROM MyCur INTO @CurCode; WHILE @@FETCH_STATUS=0 BEGIN --你的处理SQL FETCH NEXT FROM MyCur INTO @CurCode; END; CLOSE MyCur; DEALLOCATE MyCur;
DECLARE @CurCode NVARCHAR(36); DECLARE MyCur CURSOR FOR SELECT [ID] FROM [Table]; OPEN MyCur; FETCH NEXT FROM MyCur INTO @CurCode; WHILE @@FETCH_STATUS=0 BEGIN --你的处理SQL FETCH NEXT FROM MyCur INTO @CurCode; END; CLOSE MyCur; DEALLOCATE MyCur;