IF OBJECT_ID('V_EST_PROD_KIT_CPL_DROGRASMIL') IS NOT NULL
BEGIN
	DROP VIEW V_EST_PROD_KIT_CPL_DROGRASMIL
END

GO

CREATE VIEW V_EST_PROD_KIT_CPL_DROGRASMIL
AS
SELECT  
	CD_PROD_KIT, 
	ISNULL(VPU.CD_PROD_BANDEIRA,cpl.CD_PROD) AS CD_PROD, 
	QT_PROD, 
	VLR_PROD_KIT 
FROM EST_PROD_KIT_CPL cpl LEFT JOIN V_CAD_UNICO_DEPARAS_EST_PROD VPU ON
	CPL.CD_PROD=VPU.CD_PROD
