IF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[TRG_PDV_FECHA_MOV_AUDIT]'))

/****** Object:  Trigger [TRG_PDV_FECHA_MOV_AUDIT]    Script Date: 10/01/2014 09:33:26 ******/
DROP TRIGGER [dbo].[TRG_PDV_FECHA_MOV_AUDIT]
GO

/****** Object:  Trigger [dbo].[TRG_PDV_FECHA_MOV_AUDIT]    Script Date: 10/01/2014 09:33:27 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TRIGGER [dbo].[TRG_PDV_FECHA_MOV_AUDIT] ON [dbo].[PDV_VD_FECHA_MOV] FOR DELETE AS
BEGIN
	--Tabela de auditoria
	INSERT INTO PDV_FECHA_MOV_AUDIT (CD_EMP,CD_FILIAL,DT_MOV,DT_CAD_AUDIT,CD_USU,OBS)
	 
		SELECT 
			DELETED.CD_EMP,
			DELETED.CD_FILIAL,	
			DELETED.DT_MOV,
			GETDATE(),
			DELETED.CD_USU,
			'FECHAMENTO DE CAIXA EXCLUIDO' AS OBS
			
		FROM 
			DELETED 
		
END

GO


