IF EXISTS (SELECT * FROM SYS.VIEWS WHERE NAME = 'V_EST_FISCO_ENV_TENTACLE' )
BEGIN 
	DROP VIEW V_EST_FISCO_ENV_TENTACLE
END 

GO 

CREATE VIEW V_EST_FISCO_ENV_TENTACLE
AS 
	SELECT CD_EMP
		  ,CD_FILIAL
		  ,CD_CX
		  ,CD_CTR
		  ,DT_REF
		  ,TP_ARQ
		  ,XML_FISCO
		  ,STS_ENV
		  ,NR_RECIBO
		  ,FLAG_CONSOLIDADO
		  ,STS_ULTIMO_ENV
		  ,ULTIMA_MSG
		  ,GETDATE()	AS DT_HR_CARGA
		  ,STS_ULTIMO
	  FROM EST_FISCO_ENV
 