CREATE TABLE #RS (CD_CTR INT)

INSERT INTO #RS
SELECT
	CD_CTR
FROM
	EST_NF_ENT_DANFE_PROVISORIO_EST_NF_ENT_PRE_ENTRADA
GROUP BY
	CD_CTR
HAVING 
	COUNT(CD_CTR) > 1

DELETE O FROM 
EST_NF_ENT_DANFE_PROVISORIO_EST_NF_ENT_PRE_ENTRADA O INNER JOIN #RS R ON
O.CD_CTR = R.CD_CTR 

DROP TABLE #RS

/****** OBJECT:  INDEX [IDX_CTB_EXP_MOV_DT_MOV]    SCRIPT DATE: 09/12/2012 10:25:52 ******/
IF  EXISTS (SELECT * FROM SYS.INDEXES WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[EST_NF_ENT_DANFE_PROVISORIO_EST_NF_ENT_PRE_ENTRADA]') AND NAME = N'IX_EST_NF_ENT_DANFE_PROVISORIO_EST_NF_ENT_PRE_ENTRADA')
DROP INDEX [IX_EST_NF_ENT_DANFE_PROVISORIO_EST_NF_ENT_PRE_ENTRADA] ON [DBO].[EST_NF_ENT_DANFE_PROVISORIO_EST_NF_ENT_PRE_ENTRADA]
GO

ALTER TABLE DBO.EST_NF_ENT_DANFE_PROVISORIO_EST_NF_ENT_PRE_ENTRADA ADD CONSTRAINT
	IX_EST_NF_ENT_DANFE_PROVISORIO_EST_NF_ENT_PRE_ENTRADA UNIQUE NONCLUSTERED 
	(
	CD_CTR
	) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]



