
 --AGREGAR COLUMNAS A CNT_CONTRATO
if not exists(select * FROM INFORMATION_SCHEMA.COLUMNS  where Table_Name='cnt_contrato' and column_name = 'id_documento.alquiler' )
begin
alter table cnt_contrato add [id_documento.alquiler] [int] NOT NULL DEFAULT ((0))
end


IF not  EXISTS (SELECT * FROM sys.foreign_keys WHERE parent_object_id = OBJECT_ID(N'[dbo].[cnt_contrato]') AND object_id = OBJECT_ID(N'[dbo].[FK_cnt_contrato_id_documento_alquiler]')  )
 ALTER TABLE [cnt_contrato] ADD CONSTRAINT
	FK_cnt_contrato_id_documento_alquiler FOREIGN KEY
	([id_documento.alquiler]) REFERENCES [doc_documento.alquiler]
	(id) ON UPDATE  NO ACTION ON DELETE  NO ACTION 
GO

IF NOT EXISTS(SELECT *FROM [_columnas] WHERE[tabla]='cnt_contrato'
      AND [columna]='id_documento.alquiler' AND[mostrarEnGrilla]=1 AND[ordenGrilla]=5AND[requerido]=1 AND [tipo]='int' AND[defecto]=0 AND [tamano] =100)
BEGIN
INSERT INTO [_columnas]
([tabla] ,[columna] ,[mostrarEnGrilla],[ordenGrilla],[requerido] ,[tipo],[defecto],[tamano])
 VALUES
 ('cnt_contrato' ,'id_documento.alquiler',1 ,5 ,1 ,'int' ,0 ,100)
END








--TABLA cnt_contratoEquipo_catalogo.tempario

--if not exists(select * FROM INFORMATION_SCHEMA.TABLES  where Table_Name='cnt_contratoEquipo_catalogo.tempario')
--EXEC _ini_creartabla 'cnt_contratoEquipo_catalogo.tempario', 1
--go


--if not exists(select * FROM INFORMATION_SCHEMA.COLUMNS  where Table_Name='cnt_contratoEquipo_catalogo.tempario' and column_name = 'periodoHoras' )
--begin
--alter table [cnt_contratoEquipo_catalogo.tempario] add [periodoHoras] [float] NOT NULL DEFAULT ((0.0))
--end


