1 Declare @Id varchar(50)
2 declare @CaseId int
3 DECLARE TCURSOR CURSOR FOR
4 SELECT id
5 FROM checkrequest
6
7 OPEN TCURSOR
8 FETCH FROM TCURSOR into @id
9 While @@fetch_status=0
10 Begin
11 insert into Application_Case_Seq (SeqVal) values ('a')
12 set @CaseId = scope_identity()
13 delete from Application_Case_Seq WITH (READPAST)
14 update checkrequest set checkrequestnumber= @CaseId where id=@Id
15 Fetch Next From TCURSOR Into @Id
16 End
17
18 CLOSE TCURSOR
19 DEALLOCATE TCURSOR
2 declare @CaseId int
3 DECLARE TCURSOR CURSOR FOR
4 SELECT id
5 FROM checkrequest
6
7 OPEN TCURSOR
8 FETCH FROM TCURSOR into @id
9 While @@fetch_status=0
10 Begin
11 insert into Application_Case_Seq (SeqVal) values ('a')
12 set @CaseId = scope_identity()
13 delete from Application_Case_Seq WITH (READPAST)
14 update checkrequest set checkrequestnumber= @CaseId where id=@Id
15 Fetch Next From TCURSOR Into @Id
16 End
17
18 CLOSE TCURSOR
19 DEALLOCATE TCURSOR