- DECLARE Employee_Cursor CURSOR FOR
- SELECT Updatetime,id
- FROM tblSimAccountHistory
- Order by Updatetime,id
- OPEN Employee_Cursor
- DECLARE @Updatetime datetime
- DECLARE @id decimal
- DECLARE @HID decimal
- select @HID=1
- FETCH NEXT FROM Employee_Cursor
- INTO @Updatetime, @id
- WHILE @@FETCH_STATUS = 0
- BEGIN
- update tblSimAccountHistory set HID=@HID where ID=@id and updatetime=@Updatetime
- select @HID= @HID + 1
- FETCH NEXT FROM Employee_Cursor
- INTO @Updatetime, @id
- END
- CLOSE Employee_Cursor
- DEALLOCATE Employee_Cursor