IF NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='EST_PROD_COND_CP_HISTORICO') 
BEGIN
	CREATE TABLE EST_PROD_COND_CP_HISTORICO (
		   CD_EMP INT NOT NULL,
		   CD_FILIAL INT NOT NULL,
		   CD_CTR INT NOT NULL,
		   CD_FORN INT NOT NULL,
		   HISTORICO VARCHAR(255) NOT NULL,
		   DT_HISTORICO DATETIME,
		   CD_USU INT NOT NULL,
		   CAMINHO_ARQUIVO VARCHAR(255) NULL,
		   NOME_ARQUIVO VARCHAR(255) NULL,
		   IMPORTACAO VARCHAR(50)  NULL,
		   PROCESSAMENTO VARCHAR(50) NULL,
		   TIPO VARCHAR(50)  NULL,
		   ENVIADO VARCHAR(50) NULL,
		   EMAIL VARCHAR(150)  NULL,
		   CONSTRAINT PK_EST_PROD_COND_CP_HISTORICO PRIMARY KEY(CD_EMP, CD_FILIAL, CD_CTR));
END