Nicholson, Karen
knicholson at gpsx.net
Thu Jan 15 08:57:23 CST 2004
This procedure just hits one record, it does not loop through. Any ideas why? This is only my second cursor routine, thank goodness. Oh - and the between statement is correct - all those records are there in the tblMyB32Updates. CREATE PROCEDURE dbo.gps_move_to_B32 AS declare @counter int, @system_no int, @cs_no varchar(10) declare cursortest CURSOR GLOBAL FOR select system_no, cs_no from tblMyB32Updates where system_no between 279128 AND 279364 select @counter = 1 open cursortest fetch next from cursortest into @system_no, @cs_no print convert(varchar, at system_no) + convert(varchar, at cs_no) exec ap_system_to_b32 @system_no, @cs_no, 'GUARD', 'A', 0 exec ap_system_to_b32 @system_no, @cs_no, 'GUARD', 'C', 0 exec ap_cs_account_to_change_tran @system_no, 'GUARD', @cs_no insert into system_event(cs_no, [date],event_class,comline_no,operator,scheduled_date,server_id, cs_event_no) values(@cs_no, getdate(), 'A',0,'KN','1/1/1900','A',4625) while (@@fetch_status=0) begin select @counter = @counter +1 fetch next from cursortest into @system_no, @cs_no end close cursortest deallocate cursortest GO