CREATE
TRIGGER [dbo].[OBIEE_USERSTRI_INS]ON
[dbo].[WC_OBIEE_USERS]FOR
INSERTAS
BEGIN
DECLARE
@USERNAME VARCHAR(100)DECLARE
@GROUPNAME VARCHAR(100)SELECT
@USERNAME = (SELECT USERNAME FROM Inserted)SELECT
@GROUPNAME = (SELECT GROUPNAME FROM Inserted)insert
into WC_OBIEE_AUDIT(USERNAME,GROUPNAME,USERID,DATEUPD,WORKSTN,[ACTION])select
@USERNAME,@GROUPNAME,SYSTEM_USER,getdate(),host_name() ,'Insert'/*
insert into WC_OBIEE_AUDIT(USERNAME,GROUPNAME,USERID,DATEUPD,WORKSTN,[ACTION])
select a.[USERNAME],a.GROUPNAME,SYSTEM_USER,getdate(),host_name() ,'Insert' "ACTION" from WC_OBIEE_USERS a
left outer join WC_OBIEE_AUDIT b on a.[USERNAME]=b.[USERNAME] and a.[GROUPNAME]=b.[GROUPNAME]
where b.[USERNAME] is null
*/
END
Create
TRIGGER [dbo].[OBIEE_USERSTRI_DEL]ON
[dbo].[WC_OBIEE_USERS]FOR
DELETEAS
BEGIN
DECLARE
@USERNAME1 VARCHAR(100)DECLARE
@GROUPNAME1 VARCHAR(2000)SELECT
@USERNAME1 =USERNAME,@GROUPNAME1=GROUPNAME FROM Deletedinsert
into WC_OBIEE_AUDIT(USERNAME,GROUPNAME,USERID,DATEUPD,WORKSTN,[ACTION])select
@USERNAME1,@GROUPNAME1,SYSTEM_USER,getdate(),host_name() ,'Delete'/*
insert into WC_OBIEE_AUDIT(USERNAME,GROUPNAME,USERID,DATEUPD,WORKSTN,[ACTION])
select a.[USERNAME],a.[GROUPNAME],SYSTEM_USER,getdate(),host_name() ,'Delete' "ACTION" from WC_OBIEE_AUDIT a
left outer join WC_OBIEE_USERS b on a.[USERNAME]=b.[USERNAME] and a.[GROUPNAME]=b.[GROUPNAME]
where b.[USERNAME] is null
*/
END
No comments:
Post a Comment