


--CREACION DE LA TABLA

IF NOT EXISTS(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME ='doc_documento.gasto')
BEGIN
exec[_ini_creartabla] 'doc_documento.gasto', 0
END

--CREACION COLUMNAS
IF NOT EXISTS(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME ='doc_documento.gasto' AND COLUMN_NAME ='fecha_ff')
BEGIN
alter table [doc_documento.gasto]  add   fecha_ff smalldatetime not null default 0
END

IF NOT EXISTS(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME ='doc_documento.gasto' AND COLUMN_NAME ='dias')
BEGIN
alter table [doc_documento.gasto]  add   dias int not null default 0
END

IF NOT EXISTS(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME ='doc_documento.gasto' AND COLUMN_NAME ='concepto')
BEGIN
alter table [doc_documento.gasto]  add   concepto varchar(8000) not null default ''
END

IF NOT EXISTS(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME ='doc_documento.gasto' AND COLUMN_NAME ='consignado')
BEGIN
alter table [doc_documento.gasto]  add consignado bit not null default 0
END


IF NOT EXISTS(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME ='gas_detalleGasto' AND COLUMN_NAME ='id_documento.gasto')
BEGIN
alter table [gas_detalleGasto]  add [id_documento.gasto] int not null default 0
END

IF NOT EXISTS(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME ='doc_documento.gasto' AND COLUMN_NAME ='id_usuario_solicitante')
BEGIN
alter table [doc_documento.gasto]  add   id_usuario_solicitante int not null default 0
END


IF NOT EXISTS(select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME ='gas_documento.ot_detalleGasto' AND COLUMN_NAME ='id_documento.gasto')
BEGIN
alter table [gas_documento.ot_detalleGasto]  add [id_documento.gasto] int not null default 0
END
