IF EXISTS (SELECT 1 FROM SYS.INDEXES WHERE NAME = 'IX_PDV_CUPOM_NAO_FISCAL_CD_FILIAL_NR_COO')
BEGIN   
 DROP INDEX [IX_PDV_CUPOM_NAO_FISCAL_CD_FILIAL_NR_COO] ON [dbo].[PDV_CUPOM_NAO_FISCAL]
END
GO
IF NOT EXISTS (SELECT 1 FROM SYS.INDEXES WHERE NAME = 'IX_PDV_CUPOM_NAO_FISCAL_CD_FILIAL_NR_COO')
BEGIN
	CREATE NONCLUSTERED INDEX [IX_PDV_CUPOM_NAO_FISCAL_CD_FILIAL_NR_COO] ON [dbo].[PDV_CUPOM_NAO_FISCAL] ([CD_FILIAL],[DT_CUPOM],[NR_COO],[VLR_CHQS]) INCLUDE ([CD_CX],[VLR_TOT_CUPOM])
end