﻿IF OBJECT_ID('auditlog.usp_AsyncAuditFELHASZNALOBELEPESTORTENET') IS NOT NULL BEGIN
  DROP PROCEDURE auditlog.usp_AsyncAuditFELHASZNALOBELEPESTORTENET
END
GO

IF OBJECT_ID('auditlog.usp_AsyncAuditOLDALLATOGATOTTSAG') IS NOT NULL BEGIN
  DROP PROCEDURE auditlog.usp_AsyncAuditOLDALLATOGATOTTSAG
END
GO

IF OBJECT_ID('tr_AsyncAuditFELHASZNALOBELEPESTORTENET') IS NOT NULL BEGIN
  DROP TRIGGER tr_AsyncAuditFELHASZNALOBELEPESTORTENET
END
GO

IF OBJECT_ID('tr_AsyncAuditOLDALLATOGATOTTSAG') IS NOT NULL BEGIN
  DROP TRIGGER tr_AsyncAuditOLDALLATOGATOTTSAG
END
GO

EXEC dev.sp_Global_GenerateAsyncAuditAuditPocessing
GO

ALTER QUEUE auditLog.[AuditQueue]
WITH ACTIVATION
( 
    STATUS = ON,
    PROCEDURE_NAME = auditLog.usp_AuditProcessing,
    MAX_QUEUE_READERS = 10,
    EXECUTE AS 'Kreta_tech_user'
);
GO

