select Analit MestoReg GruppaDel from MBAnalit where Vid 3174 and Grup

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
select Analit, MestoReg, GruppaDel from MBAnalit where Vid = 3174 and GruppaDel in (1149019,1381767,1643779,1381830,1405671,1643810) -- 6682
--1) ВХОДЯЩИЕ РКК
SET DATEFORMAT DMY
SET NOCOUNT ON
SET CURSOR_CLOSE_ON_COMMIT OFF
declare @Analit int,
@mr int,
@gd int
declare CRS cursor LOCAL FAST_FORWARD for
select Analit, MestoReg, GruppaDel from MBAnalit where Vid = 3174 and GruppaDel in (1149019,1381767,1643779) -- 1355
open CRS
fetch CRS into @Analit, @mr, @gd
while @@FETCH_STATUS = 0
begin
--update MBAnalit set MestoReg = ?, GruppaDel = ? where Vid = 3174 and Analit = @Analit
fetch next from CRS into @Analit, @mr, @gd
end
close CRS
deallocate CRS
SET NOCOUNT OFF
--2) ИСХОДЯЩИЕ РКК
SET DATEFORMAT DMY
SET NOCOUNT ON
SET CURSOR_CLOSE_ON_COMMIT OFF
declare @Analit int,
@mr int,
@gd int
declare CRS cursor LOCAL FAST_FORWARD for
select Analit, MestoReg, GruppaDel from MBAnalit where Vid = 3174 and GruppaDel in (1381830,1405671,1643810) -- 5327
open CRS
fetch CRS into @Analit, @mr, @gd
while @@FETCH_STATUS = 0
begin
--update MBAnalit set MestoReg = ?, GruppaDel = ? where Vid = 3174 and Analit = @Analit
fetch next from CRS into @Analit, @mr, @gd
end
close CRS
deallocate CRS
SET NOCOUNT OFF