ALTER proc [dbo]. [COMMON_PROC_TEMP2]
As
Begin
DECLARE @id varchar (50);
DECLARE @cbcontractid varchar (50);
declare @xh int;
DECLARE owner_03_cursor cursor Scroll
For select ID from cb_contract where canton_id like ' 20% '
--2. Opening cursors
Open Owner_03_cursor
FETCH NEXT from Owner_03_cursor to @cbcontractid--into must have the same number of columns as the cursor query result set
While @ @fetch_status = 0--fetch succeeds, fetch the next data
Begin
Set @xh =1
DECLARE owner_04_cursor cursor Scroll
For select ID from Cb_contract_change where [e-mail protected] ORDER by BGRQ ASC
Open Owner_04_cursor
FETCH NEXT from Owner_04_cursor to @id
While @ @fetch_status =0
Begin
Update Cb_contract_change set [email protected] where [email protected]
Set @[email protected]+1;
FETCH NEXT from Owner_04_cursor to @id
End
Close owner_04_cursor;
Deallocate owner_04_cursor;
FETCH NEXT from Owner_03_cursor to @cbcontractid--move cursor
End
Close owner_03_cursor;
Deallocate owner_03_cursor;
End
SQL Server access Process cursors