ALTER TABLE Empleados ALTER COLUMN TallaCam VARCHAR(5)
ALTER TABLE Empleados ALTER COLUMN TallaPan VARCHAR(5)
ALTER TABLE Empleados ALTER COLUMN TallaZap VARCHAR(5)
GO
CREATE TABLE Trn_ProdConsIns ( 
TipDoc VARCHAR(3) DEFAULT ('CPP') NOT NULL,
NumCons INT DEFAULT ((0)) NOT NULL,
IdCia CHAR(2) NOT NULL,
Item INT DEFAULT ((0)) NOT NULL,
IdInsumo VARCHAR(16) NOT NULL,
IdBodega VARCHAR(4) NOT NULL,
Cantidad DECIMAL(14,4) DEFAULT ((0)) NOT NULL,
CantSaldo DECIMAL(14,4) DEFAULT ((0)) NOT NULL,
CantTraslado DECIMAL(14,4) DEFAULT ((0)) NOT NULL,
CantConsumo DECIMAL(14,4) DEFAULT ((0)) NOT NULL,
CantDevuelto DECIMAL(14,4) DEFAULT ((0)) NOT NULL,
CdBodTdo VARCHAR(4) NOT NULL,
TipTdo VARCHAR(3),
Traslado INT DEFAULT ((0)) NOT NULL,
IdCiaTdo CHAR(2),
IdTipProc VARCHAR(4) NOT NULL
 CONSTRAINT PK_Trn_ProdConsIns PRIMARY KEY CLUSTERED (TipDoc,NumCons,IdCia,Item),
 CONSTRAINT CK_Trn_ProdConsInsCdBodTdo CHECK ((len([CdBodTdo])>(0))),
 CONSTRAINT CK_Trn_ProdConsInsIdBodega CHECK ((len([IdBodega])>(0))),
 CONSTRAINT CK_Trn_ProdConsInsIdCia CHECK ((len([IdCia])>(0))),
 CONSTRAINT CK_Trn_ProdConsInsIdInsumo CHECK ((len([IdInsumo])>(0))),
 CONSTRAINT CK_Trn_ProdConsInsIdTipProc CHECK ((len([IdTipProc])>(0))),
 CONSTRAINT CK_Trn_ProdConsInsTipDoc CHECK ((len([TipDoc])>(0))))
GO
ALTER TABLE Trn_ProdConsIns ADD 
 CONSTRAINT FK_Trn_ProdConsIns_Bodegas FOREIGN KEY (IdBodega) REFERENCES [dbo].[Bodegas] (IdBodega),
 CONSTRAINT FK_Trn_ProdConsIns_ProdMcias FOREIGN KEY (IdInsumo) REFERENCES [dbo].[ProdMcias] (IdProducto),
 CONSTRAINT FK_Trn_ProdConsIns_TiposProceso FOREIGN KEY (IdTipProc) REFERENCES [dbo].[TiposProceso] (IdTipProc),
 CONSTRAINT FK_Trn_ProdConsIns_Trn_ProdConsolida FOREIGN KEY (TipDoc,NumCons,IdCia) REFERENCES [dbo].[Trn_ProdConsolida] (TipDoc,NumCons,IdCia)
