CREATE TABLE LogTmComp ( 
Id BIGINT IDENTITY ( 1,1 ) NOT NULL,
IdUsuario VARCHAR(5) NOT NULL,
TipCom VARCHAR(3) NOT NULL,
NumComp INT DEFAULT ((0)) NOT NULL,
IdCia CHAR(2) NOT NULL,
Estado INT DEFAULT ((0)) NOT NULL
 CONSTRAINT PK_LogTmComp PRIMARY KEY NONCLUSTERED (Id),
 CONSTRAINT CK_LogTmCompIdCia CHECK ((len([IdCia])>(0))),
 CONSTRAINT CK_LogTmCompIdUsuario CHECK ((len([IdUsuario])>(0))),
 CONSTRAINT CK_LogTmCompTipCom CHECK ((len([TipCom])>(0))))
GO
CREATE CLUSTERED INDEX IX_LogTmCompNumComp ON LogTmComp(IdUsuario,TipCom,NumComp,IdCia)
