
/*------ ATD 412149 ------*/
-- Adicionando coluna USUARIOALTEROUSITMANUT na tabela PEDICLICOMPLEMENTO
IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'USUARIOALTEROUSITMANUT' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='PEDICLICOMPLEMENTO')) 
ALTER TABLE PEDICLICOMPLEMENTO ADD USUARIOALTEROUSITMANUT VARCHAR(100) 
go
-- Adicionando coluna ESTACAOALTEROUSITMANUT na tabela PEDICLICOMPLEMENTO
IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'ESTACAOALTEROUSITMANUT' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='PEDICLICOMPLEMENTO')) 
ALTER TABLE PEDICLICOMPLEMENTO ADD ESTACAOALTEROUSITMANUT VARCHAR(100) 
go
-- Adicionando coluna PROGRAMAALTEROUSITMANUT na tabela PEDICLICOMPLEMENTO
IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'PROGRAMAALTEROUSITMANUT' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='PEDICLICOMPLEMENTO')) 
ALTER TABLE PEDICLICOMPLEMENTO ADD PROGRAMAALTEROUSITMANUT VARCHAR(100) 
go
-- Adicionando coluna DATAALTEROUSITMANUT na tabela PEDICLICOMPLEMENTO
IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'DATAALTEROUSITMANUT' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='PEDICLICOMPLEMENTO')) 
ALTER TABLE PEDICLICOMPLEMENTO ADD DATAALTEROUSITMANUT DATETIME
go
---------------------------
-- Adicionando coluna USUARIOALTEROUSITMANUT na tabela ITEMFATURADO
IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'USUARIOALTEROUSITMANUT' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='ITEMFATURADO')) 
ALTER TABLE ITEMFATURADO ADD USUARIOALTEROUSITMANUT VARCHAR(100) 
go
-- Adicionando coluna ESTACAOALTEROUSITMANUT na tabela ITEMFATURADO
IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'ESTACAOALTEROUSITMANUT' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='ITEMFATURADO')) 
ALTER TABLE ITEMFATURADO ADD ESTACAOALTEROUSITMANUT VARCHAR(100) 
go
-- Adicionando coluna PROGRAMAALTEROUSITMANUT na tabela ITEMFATURADO
IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'PROGRAMAALTEROUSITMANUT' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='ITEMFATURADO')) 
ALTER TABLE ITEMFATURADO ADD PROGRAMAALTEROUSITMANUT VARCHAR(100) 
go
-- Adicionando coluna DATAALTEROUSITMANUT na tabela ITEMFATURADO
IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'DATAALTEROUSITMANUT' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='ITEMFATURADO')) 
ALTER TABLE ITEMFATURADO ADD DATAALTEROUSITMANUT DATETIME
go