-- God Plan, Functional Spec.-Design, chapt. 2
--
-- ADDING trigger to enable resurrection
-- mentioned in God Plan FSD, chapt. 1.4
--
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER trin_onDelete ON dbo.Trinity
AFTER DELETE
AS
BEGIN
SET NOCOUNT ON;
DECLARE @JC smallint
-- check whether the dead body is Jesus
SET @JC = (SELECT COUNT(id) FROM Deleted
WHERE Hypostasis = 'SON' AND Resurrected IS NOT NULL)
IF (@JC <> 0)
BEGIN
-- recreate Jesus from the dead
INSERT INTO Trinity
SELECT * FROM Deleted
-- update Jesus with the resurrection information
UPDATE Trinity SET Resurrected = 1
WHERE Hypostasis = 'SON'
-- verify the resurrected against (Psalm.33,21)
-- (!!! no 'GO' statements in procedure !!!)EXECUTE sp_bonesIntegrityCheck 'Psalm', 33, 21
-- update humans with the new hope:
-- - add belief
-- - add computed salvation status
ALTER TABLE Humans ADD
BelieveInChrist BIT DEFAULT NULL,
Saved BIGINT AS DeedsAndBeliefs() PERSISTED;
END
END
GO
Немає коментарів:
Дописати коментар