IF NOT EXISTS (SELECT Column_Name FROM Information_Schema.columns WHERE Table_Name = 'confs' AND Column_Name = 'permitirmaisdeumainstanciadaaplicacao') ALTER TABLE DBO.confs ADD permitirmaisdeumainstanciadaaplicacao varchar(10) NULL GO IF NOT EXISTS (SELECT Column_Name FROM Information_Schema.columns WHERE Table_Name = 'confs' AND Column_Name = 'md5') ALTER TABLE DBO.confs ADD md5 varchar(50) NULL GO IF NOT EXISTS (SELECT Column_Name FROM Information_Schema.columns WHERE Table_Name = 'confs' AND Column_Name = 'addrstorage') ALTER TABLE DBO.confs ADD addrstorage varchar(200) NULL GO IF NOT EXISTS (SELECT Column_Name FROM Information_Schema.columns WHERE Table_Name = 'notas' AND Column_Name = 'storage') ALTER TABLE DBO.notas ADD storage int not null default -1 GO IF NOT EXISTS (SELECT Column_Name FROM Information_Schema.columns WHERE Table_Name = 'confs' AND Column_Name = 'usaloginunicoenvioemails') ALTER TABLE DBO.confs ADD usaloginunicoenvioemails varchar(10) null GO IF NOT EXISTS (SELECT Column_Name FROM Information_Schema.columns WHERE Table_Name = 'confs' AND Column_Name = 'minutosenvioemails') ALTER TABLE DBO.confs ADD minutosenvioemails int not null default 15 GO if not Exists (Select Column_Name from Information_Schema.columns Where Table_Name = 'cnpj' And Column_Name = 'idcsc') ALTER TABLE dbo.cnpj ADD idcsc VARCHAR(10) NULL GO if not Exists (Select Column_Name from Information_Schema.columns Where Table_Name = 'cnpj' And Column_Name = 'csc') ALTER TABLE dbo.cnpj ADD csc VARCHAR(50) NULL CREATE TABLE artnfe.dbo.codigosmunicipios ( codigouf INT NOT NULL, codigomunicipio INT NOT NULL, nomeuf VARCHAR(50) NOT NULL, nomemunicipio VARCHAR(150) NOT NULL ) CREATE TABLE artnfe.dbo.condutores ( cpf VARCHAR(11) NOT NULL, nome VARCHAR(60) NOT NULL ) CREATE TABLE artnfe.dbo.mdfe ( cnpj VARCHAR(14) NOT NULL, numero INT IDENTITY NOT NULL, id VARCHAR(48) NOT NULL, xml TEXT, cstat VARCHAR(5), xmotivo TEXT, data_envio DATETIME, retenvimdfe TEXT, errogenerico TEXT, xmlassinado TEXT, consrecimdfe TEXT, retconsrecimdfe TEXT, data_retconsrecimdfe DATETIME, data_cancelamento DATETIME, motivocancelamento VARCHAR(255), evcancmdfe TEXT, retcancmdfe TEXT, retconssitmdfe TEXT, data_retconssitmdfe DATETIME, evencmdfe TEXT, data_encerramento DATETIME, retevencmdfe TEXT ) CREATE TABLE artnfe.dbo.mdfe_config ( modelo INT NOT NULL, serie INT NOT NULL, tipoemitente INT NOT NULL, modalidadetransporte INT NOT NULL, formaemissao INT NOT NULL ) CREATE TABLE artnfe.dbo.mdfe_inclusao_condutor ( id VARCHAR(48) NOT NULL, nseqevento INT IDENTITY NOT NULL, evinccondutormdfe TEXT, data_inclusao DATETIME, retevinccondutormdf TEXT, cstat VARCHAR(5), xmotivo TEXT, errogenerico TEXT, cpf VARCHAR(11), nome VARCHAR(40) ) CREATE TABLE artnfe.dbo.reboques ( codigointerno INT IDENTITY NOT NULL, nome VARCHAR(100) NOT NULL, tipocarroceria VARCHAR(2) NOT NULL, placa VARCHAR(10) NOT NULL, tara INT NOT NULL, renavam VARCHAR(20), uf VARCHAR(2) NOT NULL, tiporodado VARCHAR(2) NOT NULL, capacidadekg INT, capacidadem3 INT, proprietarionaoemitente INT DEFAULT 0 NOT NULL, nomeproprietario VARCHAR(60), cpfcnpjproprietario VARCHAR(20), rntrcproprietario VARCHAR(8), ieproprietario VARCHAR(14), ufproprietario VARCHAR(2), tipoproprietario INT DEFAULT -1, ativo INT DEFAULT 1 ) CREATE TABLE artnfe.dbo.veiculos ( codigointerno INT IDENTITY NOT NULL, nome VARCHAR(100) NOT NULL, tipocarroceria VARCHAR(2) NOT NULL, placa VARCHAR(10) NOT NULL, tara INT NOT NULL, renavam VARCHAR(20), uf VARCHAR(2) NOT NULL, tiporodado VARCHAR(2) NOT NULL, capacidadekg INT, capacidadem3 INT, proprietarionaoemitente INT DEFAULT 0 NOT NULL, nomeproprietario VARCHAR(60), cpfcnpjproprietario VARCHAR(20), rntrcproprietario VARCHAR(8), ieproprietario VARCHAR(14), ufproprietario VARCHAR(2), tipoproprietario INT DEFAULT (-1), ativo INT DEFAULT 1 )