ALTER TABLE TMPAIN ADD TMP_PED DECIMAL(14,4) DEFAULT(0)
GO
CREATE TABLE TMPLBCO ( 
TMP_UID CHAR(2) DEFAULT ('01') NOT NULL,
TMP_ID INT DEFAULT ((0)) NOT NULL,
TMP_CUE VARCHAR(16) NOT NULL,
TMP_CUN VARCHAR(16) NOT NULL,
TMP_CIA CHAR(2) DEFAULT ('00') NOT NULL,
TMP_NIT VARCHAR(11) DEFAULT ('0') NOT NULL,
TMP_CC VARCHAR(3) DEFAULT ('0') NOT NULL,
TMP_AGE VARCHAR(9) DEFAULT ('N'),
TMP_TIP VARCHAR(10) NOT NULL,
TMP_SAN MONEY DEFAULT ((0)),
TMP_DEB MONEY DEFAULT ((0)),
TMP_CRE MONEY DEFAULT ((0)),
TMP_SAL MONEY DEFAULT ((0)),
TMP_SA2 MONEY DEFAULT ((0)),
TMP_DB2 MONEY DEFAULT ((0)),
TMP_CR2 MONEY DEFAULT ((0)),
TMP_NS2 MONEY DEFAULT ((0))
 CONSTRAINT PK_TMPLBCO PRIMARY KEY NONCLUSTERED (TMP_UID,TMP_ID),
 CONSTRAINT CK_TMPLBCOTMP_CC CHECK ((len([TMP_CC])>(0))),
 CONSTRAINT CK_TMPLBCOTMP_CIA CHECK ((len([TMP_CIA])>(0))),
 CONSTRAINT CK_TMPLBCOTMP_CUE CHECK ((len([TMP_CUE])>(0))),
 CONSTRAINT CK_TMPLBCOTMP_CUN CHECK ((len([TMP_CUN])>(0))),
 CONSTRAINT CK_TMPLBCOTMP_NIT CHECK ((len([TMP_NIT])>(0))),
 CONSTRAINT CK_TMPLBCOTMP_TIP CHECK ((len([TMP_TIP])>(0))),
 CONSTRAINT CK_TMPLBCOTMP_UID CHECK ((len([TMP_UID])>(0))))
GO
 CREATE CLUSTERED INDEX IX_TMPLBCOTMP_CUN ON TMPLBCO(TMP_CUN,TMP_CIA,TMP_NIT,TMP_TIP)

