DELETE
FROM
EST_META_VEND
WHERE
	ANO_META <2015;

DELETE
FROM
	EST_META_FILIAL
WHERE
	ANO_META <2015;

BEGIN TRY
	DROP INDEX [IDX_EST_META_FILIAL_CPL_02] ON [dbo].[EST_META_FILIAL_CPL];
END TRY
BEGIN CATCH
END CATCH

BEGIN TRY
	DROP INDEX [IDX_EST_META_FILIAL_CPL_02] ON [dbo].[EST_META_FILIAL_CPL];
END TRY
BEGIN CATCH
END CATCH


BEGIN TRY
	ALTER TABLE [dbo].[EST_META_FILIAL_CPL] DROP CONSTRAINT [IDX_EST_META_FILIAL_CPL];
END TRY
BEGIN CATCH
END CATCH

ALTER TABLE dbo.EST_META_FILIAL_CPL ADD CONSTRAINT
	IDX_EST_META_FILIAL_CPL UNIQUE NONCLUSTERED 
	(
	
	DT_META,
	CD_FILIAL,
	CD_EMP
	) WITH( PAD_INDEX = OFF, FILLFACTOR = 98, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]


