-
Notifications
You must be signed in to change notification settings - Fork 0
/
V202408150923__v2.3.x.sql
53 lines (50 loc) · 1.74 KB
/
V202408150923__v2.3.x.sql
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
-----------------------------------------------------------------
-- SQL Code Generation
-- Entity: Company Integration Runs
-- Item: spCreateCompanyIntegrationRun
-- Generated: 8/15/2024, 9:14:48 PM
--
-- This was generated by the MemberJunction CodeGen tool.
-- This file should NOT be edited by hand.
-----------------------------------------------------------------
------------------------------------------------------------
----- CREATE PROCEDURE FOR CompanyIntegrationRun
------------------------------------------------------------
DROP PROCEDURE IF EXISTS [${flyway:defaultSchema}].[spCreateCompanyIntegrationRun]
GO
CREATE PROCEDURE [${flyway:defaultSchema}].[spCreateCompanyIntegrationRun]
@CompanyIntegrationID uniqueidentifier,
@RunByUserID uniqueidentifier,
@StartedAt datetime,
@EndedAt datetime,
@TotalRecords int,
@Comments nvarchar(MAX)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @InsertedRow TABLE ([ID] UNIQUEIDENTIFIER)
INSERT INTO
[${flyway:defaultSchema}].[CompanyIntegrationRun]
(
[CompanyIntegrationID],
[RunByUserID],
[StartedAt],
[EndedAt],
[TotalRecords],
[Comments]
)
OUTPUT INSERTED.[ID] INTO @InsertedRow
VALUES
(
@CompanyIntegrationID,
@RunByUserID,
@StartedAt,
@EndedAt,
@TotalRecords,
@Comments
)
-- return the new record from the base view, which might have some calculated fields
SELECT * FROM [${flyway:defaultSchema}].[vwCompanyIntegrationRuns] WHERE [ID] = (SELECT [ID] FROM @InsertedRow)
END
GO
GRANT EXECUTE ON [${flyway:defaultSchema}].[spCreateCompanyIntegrationRun] TO [cdp_Developer], [cdp_Integration]