ALTER TABLE CRM_Mails DROP COLUMN Estado
GO

IF COL_LENGTH('CRM_Mails', 'Estado') IS NULL ALTER TABLE CRM_Mails ADD Estado CHAR(1)
GO

IF COL_LENGTH('CRM_Mails', 'Error_Cod') IS NULL ALTER TABLE CRM_Mails ADD Error_Cod INT
GO

IF COL_LENGTH('CRM_Mails', 'Error_Descrip') IS NULL ALTER TABLE CRM_Mails ADD Error_Descrip VARCHAR(5000)
GO

CREATE INDEX IX_CML_PorAsun ON CRM_Mails (Asunto,Creado)

CREATE INDEX IX_CML_PorDe ON CRM_Mails (De,Creado)

CREATE INDEX IX_CML_PorA ON CRM_Mails (A,Creado)

CREATE INDEX IX_CML_PorCC ON CRM_Mails (CC,Creado)

CREATE INDEX IX_CML_PorBCC ON CRM_Mails (BCC,Creado)


