Create trigger to
restrict a user(s) from accessing table for INSERT/DELETE/UPDATE in given time;
CREATE TRIGGER dbo.trg_Trigger
ON dbo.YourTable
AFTER INSERT,DELETE,UPDATE
AS
BEGIN
SET NOCOUNT ON;
-- If you are
using SQL Server authentication, you can use '%\A' or 'domainname\A'
if SYSTEM_USER = 'A' And DatePart(hh,getdate()) between 10 and 13
begin
Raiserror('Un Authorize access.',11,1)
Rollback
Return
end
END
GO
No comments:
Post a Comment