-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCreateSPs.txt
More file actions
155 lines (145 loc) · 5.11 KB
/
Copy pathCreateSPs.txt
File metadata and controls
155 lines (145 loc) · 5.11 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
CREATE PROCEDURE [dbo].[FindAppInsightLogById]
@LogId nvarchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT Id,ApplicationId,AppInsightType,ProblemId,ProblemIdBase64, OuterType, Type, InnerMostType, OuterAssembly, Assembly, OuterMethod, Method, ExceptionCount, DateCreated FROM AppInsightLogs WHERE Id= @LogId
END
GO
CREATE PROCEDURE [dbo].[FindAppInsightLogsById]
@ApplicationId nvarchar(50),
@DateFrom datetime,
@AppInsightType int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT Id,ApplicationId,AppInsightType,ProblemId,ProblemIdBase64, OuterType, Type, InnerMostType, OuterAssembly, Assembly, OuterMethod, Method, ExceptionCount, DateCreated FROM AppInsightLogs WHERE ApplicationId= @ApplicationId AND AppInsightType=@AppInsightType AND DateCreated > @DateFrom
END
GO
CREATE PROCEDURE [dbo].[FindAppInsightLogsByIdAndProblemId]
@ApplicationId nvarchar(50),
@ProblemIdBase64 nvarchar(500),
@DateFrom datetime,
@AppInsightType int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT Id,ApplicationId,AppInsightType,ProblemId,ProblemIdBase64, OuterType, Type, InnerMostType, OuterAssembly, Assembly, OuterMethod, Method, ExceptionCount, DateCreated FROM AppInsightLogs WHERE ApplicationId= @ApplicationId AND AppInsightType=@AppInsightType AND ProblemIdBase64=@ProblemIdBase64 AND DateCreated > @DateFrom
END
GO
CREATE PROCEDURE [dbo].[FindApplicationById]
@ApplicationId nvarchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT * FROM Applications WHERE Id = @ApplicationId
END
GO
CREATE PROCEDURE [dbo].[FindTriggeredAlertsById]
@ApplicationId nvarchar(50),
@DateFrom datetime
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
SELECT Id,ApplicationId,AlertId,Title,DateTriggered FROM TriggeredAlerts WHERE [ApplicationId]= @ApplicationId AND DateTriggered > @DateFrom
END
GO
CREATE PROCEDURE [dbo].[InsertAppInsightLog]
-- Add the parameters for the stored procedure here
@ApplicationId nvarchar(50),
@AppInsightType int,
@DateCreated nvarchar(50),
@ProblemId nvarchar(max),
@ProblemIdBase64 nvarchar(max),
@OuterType nvarchar(max),
@Type nvarchar(max),
@InnermostType nvarchar(max),
@OuterAssembly nvarchar(max),
@Assembly nvarchar(max),
@OuterMethod nvarchar(max),
@Method nvarchar(max),
@Count int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO AppInsightLogs (ApplicationId, AppInsightType, DateCreated, ProblemId, ProblemIdBase64, OuterType, Type, InnermostType, OuterAssembly, Assembly, OuterMethod, Method, ExceptionCount) Values (@ApplicationId, @AppInsightType, @DateCreated, @ProblemId, @ProblemIdBase64, @OuterType, @Type, @InnermostType,@OuterAssembly ,@Assembly,@OuterMethod,@Method,@Count)
END
GO
CREATE PROCEDURE [dbo].[InsertApplication]
-- Add the parameters for the stored procedure here
@ApplicationId nvarchar(50),
@Title nvarchar(50),
@InsightsId nvarchar(50),
@InsightsKey nvarchar(50),
@NextHourly datetime,
@NextDaily datetime
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO Applications (Id, Title, NextHourly, NextDaily, ApplicationInsightsId, ApplicationInsigtsKey) Values (@ApplicationId, @Title, @NextHourly, @NextDaily, @InsightsId, @InsightsKey)
END
GO
CREATE PROCEDURE [dbo].[InsertTriggeredAlert]
-- Add the parameters for the stored procedure here
@ApplicationId nvarchar(50),
@Title nvarchar(50),
@AlertId nvarchar(50),
@DateTriggered datetime
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
INSERT INTO TriggeredAlerts (ApplicationId, AlertId, Title, DateTriggered) Values (@ApplicationId, @AlertId, @Title, @DateTriggered)
END
GO
CREATE PROCEDURE [dbo].[SetNextDaily]
@ApplicationId nvarchar(50),
@NextDaily datetime
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE Applications
SET NextDaily = @NextDaily
WHERE Id = @ApplicationId
END
GO
CREATE PROCEDURE [dbo].[SetNextHourly]
@ApplicationId nvarchar(50),
@NextHourly datetime
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
UPDATE Applications
SET NextHourly = @NextHourly
WHERE Id = @ApplicationId
END
GO