· 5 years ago · Mar 02, 2020, 03:08 PM
1USE [iConIRNet_SCU]
2GO
3/****** Object: StoredProcedure [dbo].[ConvertItNowFileNumber] Script Date: 3/2/2020 9:05:10 AM ******/
4SET ANSI_NULLS ON
5GO
6SET QUOTED_IDENTIFIER ON
7GO
8
9
10
11-- select top 1 * from MigrationFile where Priority = 9 and status = 0
12
13
14
15
16create Procedure [dbo].[ConvertItNowFileNumber]
17(@FileNumber varchar(100))
18as
19begin
20
21 select ID into #FileIDs from MigrationFile where srcFileNumber = @FileNumber
22
23 update MigrationFile set Priority = 0 where id in (select ID from #FileIDs)
24 update MigrationDocument set Priority = 0 where FileId in (select ID from #FileIDs)
25
26 drop table #FileIDs
27
28 exec Process @System = 'SCU_Phase2', @StopAtPriority=1
29end
30GO
31/****** Object: StoredProcedure [dbo].[ConvertItNowFileNumberErrors] Script Date: 3/2/2020 9:05:10 AM ******/
32SET ANSI_NULLS ON
33GO
34SET QUOTED_IDENTIFIER ON
35GO
36
37
38
39
40
41
42-- select top 1 * from MigrationFile where Priority = 9 and status = 0
43
44
45
46
47create Procedure [dbo].[ConvertItNowFileNumberErrors]
48(@FileNumber varchar(100))
49as
50begin
51 If not exists (select 1 from Migrationfile where SrcFileNumber = @FileNumber)
52 begin
53 select COUNT=-1
54 end
55 else
56 select COUNT=count(*) from MigrationDocument where status = -1 and SrcFileNumber = @FileNumber
57
58end
59GO
60/****** Object: StoredProcedure [dbo].[ConvertItNowFileNumberRemaining] Script Date: 3/2/2020 9:05:10 AM ******/
61SET ANSI_NULLS ON
62GO
63SET QUOTED_IDENTIFIER ON
64GO
65
66
67
68
69create Procedure [dbo].[ConvertItNowFileNumberRemaining]
70(@FileNumber varchar(100))
71as
72begin
73
74 If not exists (select 1 from Migrationfile where SrcFileNumber = @FileNumber)
75 begin
76 select COUNT=-1
77 end
78 else
79 select COUNT=count(*) from MigrationDocument where status not in (1,-1,-5) and SrcFileNumber = @FileNumber
80
81end
82GO