...
Code Block |
---|
--------------------------------------------------------- -- SQLSERVER DDL SCRIPT -- Create Direct table for SAM Access -- Ebiexperts 2024-03-08 JPG -- SAM_DEMO_NEW.dbo.SAM_ExtRules01 definition --------------------------------------------------------- -- Drop table -- DROP TABLE SAM_DEMO_NEW.dbo.SAM_ExtRules; CREATE TABLE SAM_ExtRules ( RuleId int IDENTITY(1,1) NOT NULL, AppName nvarchar(2000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, ActorName nvarchar(2000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, SaACCESS nvarchar(10) COLLATE SQL_Latin1_General_CP1_CI_AS DEFAULT 'USER' NOT NULL, SaOMIT nvarchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS DEFAULT '' NULL, SaRESTRICT text COLLATE SQL_Latin1_General_CP1_CI_AS DEFAULT '' NULL, CreateDate datetime DEFAULT getdate() NULL, ModifDate datetime DEFAULT getdate() NULL, CONSTRAINT SAM_ExtRules01_PK PRIMARY KEY (RuleId) ); CREATE NONCLUSTERED INDEX SAM_ExtRules_AppName_IDX ON SAM_ExtRules ( AppName ASC , ActorName ASC ) WITH ( PAD_INDEX = OFF ,FILLFACTOR = 100 ,SORT_IN_TEMPDB = OFF , IGNORE_DUP_KEY = OFF , STATISTICS_NORECOMPUTE = OFF , ONLINE = OFF , ALLOW_ROW_LOCKS = ON , ALLOW_PAGE_LOCKS = ON ) ON [PRIMARY ] ; CREATE TRIGGER trgAfterUpdate ON SAM_ExtRules AFTER UPDATE AS UPDATE SAM_ExtRules SET ModifDate = GETDATE() FROM Inserted i WHERE dbo.SAM_ExtRules.RuleId = i.RuleId |
NOTE:
Rules will not work correctly- when there are two external app with same names as we don't get the AppID from external sources it's too difficult to do for that so we work on distinct/unique names of the apps.