IP
8cc6d14d-1889-4cdf-9d55-fdfdf87fa74f
St. Joseph-Lincoln Senior Center
8cc6d14d-1889-4cdf-9d55-fdfdf87fa74f
Customer
Survey Link has been copied to your clipboard
Survey(s)
Training Notes
Call Logs
General Notes
Tasks
Center Specific SQL
Could use some polish. Checks if reminder exists, and if person has a photo. If not, adds a new reminder.
Heading 6
Mass add reminders to get your picture taken
Created By:
Billy J
Created On:
10/10/22
USE WEB_MI_SAINTJOSEPHWEB;
DECLARE @ReminderStart DATE = GETDATE()
BEGIN TRAN;
with cte_exists as (
SELECT Reminder_SeniorID
FROM Reminders
WHERE Reminder_Text like 'Please touch your name in the top-left corner to take your photo or see a staff member for assistance' and Reminder_Active = 1
)
,cte_add as (
SELECT Seniors_personID
FROM Seniors
WHERE PhotoKey IS NULL or LEN(PhotoKey) = 0 or PhotoKey = '8c827238-a194-4249-9714-4c0617112cc4.png'
)
,cte_except as (
SELECT Seniors_PersonID
FROM cte_add
EXCEPT
SELECT Reminder_SeniorID
FROM cte_exists
)
--SELECT * FROM cte_except
INSERT INTO Reminders (reminder_mass, reminder_personid, reminder_seniorid, reminder_type, reminder_text, reminder_datestart, reminder_dateend, reminder_active, siteid)
SELECT 0, 'MSC Support', Seniors_PersonID, null,'Please your name in the top-left corner to take your photo or see a staff member for assistance', @ReminderStart, '2030-12-31',1,1
FROM cte_except
;
--SELECT * FROM Reminders order by reminder_id;
ROLLBACK Tran;
COMMIT TRAN;
MySeniorCenter
Employees Only
If you are seeing this page you are either not authorized or your IP address has changed
Your Current IP Address is 23.23.59.232. Please send this to bill@myseniorcenter.com if you are an employee of MySeniorCenter