IF NOT EXISTS (SELECT * FROM sysobjects WHERE Name='Contratos_Tipos_Cuotas' AND xtype='U')
BEGIN
	CREATE TABLE dbo.Contratos_Tipos_Cuotas
	(
		Id_Tipo_Con_Cuota		INT IDENTITY(1,1) NOT NULL,
		Id_Tipo_Con				SMALLINT NOT NULL,
		Cuotas					SMALLINT NULL,
		Descripcion				VARCHAR(100) NOT NULL,
		Interes					DECIMAL(9,5) NULL
	)
END
GO

IF NOT EXISTS (SELECT * FROM sysobjects WHERE Name='PK_ConTC_PorId' AND xtype='PK')
BEGIN
	ALTER TABLE Contratos_Tipos_Cuotas ADD CONSTRAINT PK_ConTC_PorId PRIMARY KEY CLUSTERED (Id_Tipo_Con_Cuota)
END
GO

IF NOT EXISTS (SELECT * FROM sysobjects WHERE Name='FK_ConTC_Contratos' AND xtype='F')
BEGIN
	ALTER TABLE Contratos_Tipos_Cuotas ADD CONSTRAINT FK_ConTC_Contratos FOREIGN KEY (Id_Tipo_Con) REFERENCES Contratos_Tipos (Id_Tipo_Con)
END
GO