IF EXISTS( SELECT * FROM SYS.VIEWS
		  WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[V_CONCILIACAO_EEXTRATO]'))
    DROP VIEW [DBO].[V_CONCILIACAO_EEXTRATO];
GO
SET ANSI_NULLS ON;
GO
SET QUOTED_IDENTIFIER ON;
GO
CREATE VIEW [DBO].[V_CONCILIACAO_EEXTRATO]
AS
     SELECT DISTINCT
            CD_EMP,
            CD_CTR_LOTE,
            DS_LOTE,
            DT_CAD,
			0 Tipo
     FROM RC_CONC_PDV_VD_TEF
     UNION ALL
     SELECT DISTINCT
            CD_EMP,
            CD_CTR_LOTE,
            DS_LOTE,
            DT_CAD,
			1 Tipo
     FROM RC_CONC_PDV_CUPOM_NAO_FISCAL_TEF;
GO
 