
/*------ ATD 285564 ------*/
-- Adicionando coluna BANDEIRA na tabela TRANSACAOCARTAO
IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'BANDEIRA' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='TRANSACAOCARTAO')) 
ALTER TABLE TRANSACAOCARTAO ADD BANDEIRA CHAR(5) NOT NULL DEFAULT ''
go

-- Adicionando coluna COD_ADMINISTRADORA na tabela TRANSACAOCARTAO
IF NOT EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'COD_ADMINISTRADORA' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='TRANSACAOCARTAO')) 
ALTER TABLE TRANSACAOCARTAO ADD COD_ADMINISTRADORA CHAR(5) NOT NULL DEFAULT ''
go

--Alterar estrtura da coluna NSU_ADMINISTRADORA
IF EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'NSU_ADMINISTRADORA' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='TRANSACAOCARTAO')) 
ALTER TABLE TRANSACAOCARTAO ALTER COLUMN NSU_ADMINISTRADORA INT
go

---Alterar estrutura da coluna AUTORIZACAO
IF EXISTS (SELECT 1 FROM SYSCOLUMNS WHERE name = 'AUTORIZACAO' and syscolumns.id IN (SELECT ID FROM SYSOBJECTS WHERE xtype='U' AND name='TRANSACAOCARTAO')) 
ALTER TABLE TRANSACAOCARTAO ALTER COLUMN AUTORIZACAO VARCHAR(15)
go
