ALTER TABLE tm_Aportes ADD tmDiasDnrPen INT DEFAULT(0) NOT NULL,tmDiasDnrSal INT DEFAULT(0) NOT NULL
GO
ALTER TABLE Trn_NomAlqNov ADD DiasDnrPen INT DEFAULT(0) NOT NULL,DiasDnrSal INT DEFAULT(0) NOT NULL
GO
ALTER TABLE Trn_Opedido ADD NumAutSicom VARCHAR(50)
GO
CREATE TABLE tm_NiifLib ( 
tmItem BIGINT IDENTITY ( 1,1 ) NOT NULL,
tmEst CHAR(2) DEFAULT ('01') NOT NULL,
tmTipCom VARCHAR(3) NOT NULL,
tmIdCuenta VARCHAR(16) DEFAULT ('0') NOT NULL,
tmIdTercero VARCHAR(16) DEFAULT ('0') NOT NULL,
tmIdCCosto VARCHAR(16) DEFAULT ('0') NOT NULL,
tmIdSubCos VARCHAR(16) DEFAULT ('0') NOT NULL,
tmIdCia CHAR(2) DEFAULT ('0') NOT NULL,
tmTotalDebitos MONEY DEFAULT ((0)) NOT NULL,
tmTotalCreditos MONEY DEFAULT ((0)) NOT NULL,
tmSaldoAnterior MONEY DEFAULT ((0)) NOT NULL,
tmSanNit MONEY DEFAULT ((0)) NOT NULL,
tmSanNitcc MONEY DEFAULT ((0)) NOT NULL,
tmSanNitCcSub MONEY DEFAULT ((0)) NOT NULL
 CONSTRAINT PK_tm_NiifLib PRIMARY KEY NONCLUSTERED (tmItem),
 CONSTRAINT CK_tm_NiifLibtmEst CHECK ((len([tmEst])>(0))),
 CONSTRAINT CK_tm_NiifLibtmIdCCosto CHECK ((len([tmIdCCosto])>(0))),
 CONSTRAINT CK_tm_NiifLibtmIdCia CHECK ((len([tmIdCia])>(0))),
 CONSTRAINT CK_tm_NiifLibtmIdCuenta CHECK ((len([tmIdCuenta])>(0))),
 CONSTRAINT CK_tm_NiifLibtmIdSubCos CHECK ((len([tmIdSubCos])>(0))),
 CONSTRAINT CK_tm_NiifLibtmIdTercero CHECK ((len([tmIdTercero])>(0))),
 CONSTRAINT CK_tm_NiifLibtmTipCom CHECK ((len([tmTipCom])>(0))))
GO
 CREATE CLUSTERED INDEX IX_tm_NiifLibtmIdCuenta ON tm_NiifLib(tmEst,tmTipCom,tmIdCuenta,tmIdTercero,tmIdCia)
 CREATE NONCLUSTERED INDEX IX_tm_NiifLibtmIdCCosto ON tm_NiifLib(tmIdCCosto,tmIdSubCos)
