IF EXISTS
(
    SELECT *
    FROM sys.views
    WHERE object_id = OBJECT_ID(N'[dbo].V_EST_PROD_TBL_DESC_CARGA_TENTACLE')
)
    DROP VIEW [dbo].[V_EST_PROD_TBL_DESC_CARGA_TENTACLE];
GO
CREATE VIEW [dbo].[V_EST_PROD_TBL_DESC_CARGA_TENTACLE]
AS

SELECT CD_EMP,
	   CD_TBL_DESC,
	   CD_TP_DESCONTO,
	   CD_USU,
	   DS_TBL_DESC,
	   CONVERT (DATE,DT_FIM)as DT_FIM,
	   CONVERT (DATE,DT_INI)as DT_INI,
	   FLAG_BLOQUEIO_DESC,
	   FLAG_DESC_FIX,
	   ISNULL(FLAG_DESC_RECEITA, 0) AS FLAG_DESC_RECEITA,
	   FLAG_OFERTA_SOBREPOE_TABELA,
	   ST_PRORROG,
	   STS_TBL_DESC,
	   FLAG_APLICA_DESCONTO_QTDE_MULTIPLO,
	   FLAG_AGREGAR_DESC_QTDE_AOS_DESCONTOS_EXISTENTES,
	   GETDATE() AS DT_HR_CARGA 
FROM	EST_PROD_TBL_DESC TBL
WHERE	TBL.CD_EMP = 1
AND TBL.ORIG_VENDA IN ( 0 , 1 )