-
Notifications
You must be signed in to change notification settings - Fork 0
/
CadenceUpdateSMSOpt.sql
47 lines (39 loc) · 988 Bytes
/
CadenceUpdateSMSOpt.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
USE [Campus6]
GO
/****** Object: StoredProcedure [custom].[CadenceUpdateSMSOpt] Script Date: 2021-01-05 14:57:08 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Wyatt Best
-- Create date: 2020-11-04
-- Description: Updates a SMS Opt-In row.
-- =============================================
CREATE PROCEDURE [custom].[CadenceUpdateSMSOpt] @PCID NVARCHAR(10)
,@Dept NVARCHAR(10)
,@OptedIn BIT
,@OPID NVARCHAR(8)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @OptStatus NCHAR(1) = (
SELECT CASE @OptedIn
WHEN 1
THEN 'A'
WHEN 0
THEN 'I'
ELSE NULL
END
)
UPDATE TELECOMMUNICATIONS
SET [STATUS] = @OptStatus
,COMMENTS = 'Updated ' + format(getdate(), 'g') + ' by ' + @OPID
,REVISION_DATE = dbo.fnMakeDate(getdate())
,REVISION_TIME = dbo.fnMakeTime(getdate())
,REVISION_OPID = @OPID
WHERE PEOPLE_ORG_CODE_ID = @PCID
AND COM_TYPE = 'SMS' + @Dept
SELECT @@ROWCOUNT
END
GO