if exists (select * from information_schema.tables
					where TABLE_NAME ='V_EST_PROD_TBL_DESC_CARGA_PDV' )
	drop VIEW V_EST_PROD_TBL_DESC_CARGA_PDV

go

CREATE VIEW V_EST_PROD_TBL_DESC_CARGA_PDV
AS
     SELECT            
		 CD_EMP
		, CD_TBL_DESC
		, DS_TBL_DESC
		, DT_INI
		, DT_FIM
		, DT_FIM_ORIG
		, ST_PRORROG
		, CD_TP_DESCONTO
		, CD_USU
		, DT_CAD
		, DT_ULT_ALT
		, ISNULL(STS_TBL_DESC				,0) STS_TBL_DESC
		, ISNULL(FLAG_DESC_FIX				,0) FLAG_DESC_FIX
		, ISNULL(FLAG_DESC_RECEITA			,0) FLAG_DESC_RECEITA
		, ISNULL(FLAG_BLOQUEIO_DESC			,0) FLAG_BLOQUEIO_DESC
		, ISNULL(FLAG_DESC_USO_CONTINUO		,0) FLAG_DESC_USO_CONTINUO
		, ISNULL(FLAG_DESC_PBM				,0) FLAG_DESC_PBM
		, ISNULL(FLAG_OFERTA_SOBREPOE_TABELA,0) FLAG_OFERTA_SOBREPOE_TABELA
		, FLAG_APLICA_DESCONTO_QTDE_MULTIPLO
		, FLAG_AGREGAR_DESC_QTDE_AOS_DESCONTOS_EXISTENTES
		, getdate() DT_HR_CARGA
     FROM
          EST_PROD_TBL_DESC TBL
     --WHERE  CONVERT(DATE,GETDATE()) BETWEEN TBL.DT_INI AND  TBL.DT_FIM ;