CREATE TABLE ACTIVIDADES ( 
ACT_COD VARCHAR(8) NOT NULL,
ACT_DES VARCHAR(250) NOT NULL,
ACT_RTC VARCHAR(3)
 CONSTRAINT PK_ACTIVIDADES PRIMARY KEY CLUSTERED (ACT_COD),
 CONSTRAINT CK__ACTIVIDAD__ACT_C__77BFCB91 CHECK ((len([ACT_COD]) > 0)),
 CONSTRAINT CK__ACTIVIDAD__ACT_D__78B3EFCA CHECK ((len([ACT_DES]) > 0)))
CREATE TABLE AGENCIAS ( 
AGE_COD VARCHAR(9) NOT NULL,
AGE_NIT VARCHAR(11) NOT NULL,
AGE_NOM VARCHAR(50) NOT NULL,
AGE_DIR VARCHAR(50),
AGE_CIU VARCHAR(8) NOT NULL,
AGE_TEL VARCHAR(20),
AGE_ID INT IDENTITY ( 1,1 ) NOT NULL,
AGE_EML VARCHAR(250)
 CONSTRAINT PK_AGENCIAS PRIMARY KEY CLUSTERED (AGE_COD,AGE_NIT),
 CONSTRAINT CK__AGENCIAS__AGE_CI__7E6CC920 CHECK ((len([AGE_CIU]) > 0)),
 CONSTRAINT CK__AGENCIAS__AGE_CO__7B905C75 CHECK ((len([AGE_COD]) > 0)),
 CONSTRAINT CK__AGENCIAS__AGE_NI__7C8480AE CHECK ((len([AGE_NIT]) > 0)),
 CONSTRAINT CK__AGENCIAS__AGE_NO__7D78A4E7 CHECK ((len([AGE_NOM]) > 0)))
CREATE TABLE BANCOS ( 
BAN_COD VARCHAR(3) NOT NULL,
BAN_DES VARCHAR(30) NOT NULL,
BAN_TAR BIT DEFAULT (0) NOT NULL,
BAN_POR DECIMAL(10,4) DEFAULT (0),
BAN_ENT VARCHAR(20)
 CONSTRAINT PK_BANCOS PRIMARY KEY CLUSTERED (BAN_COD),
 CONSTRAINT CK__BANCOS__BAN_COD__014935CB CHECK ((len([BAN_COD]) > 0)),
 CONSTRAINT CK__BANCOS__BAN_DES__023D5A04 CHECK ((len([BAN_DES]) > 0)))
CREATE TABLE CARGAS ( 
CAR_COD VARCHAR(13) NOT NULL,
CAR_DES VARCHAR(250),
CAR_UNI VARCHAR(3) NOT NULL,
CAR_LIN VARCHAR(6),
CAR_NAT VARCHAR(3),
CAR_CMT VARCHAR(13)
 CONSTRAINT PK_CARGAS PRIMARY KEY CLUSTERED (CAR_COD),
 CONSTRAINT CK__CARGAS__CAR_COD__07020F21 CHECK ((len([CAR_COD]) > 0)),
 CONSTRAINT CK__CARGAS__CAR_DES__07F6335A CHECK ((len([CAR_DES]) > 0)),
 CONSTRAINT CK__CARGAS__CAR_UNI__08EA5793 CHECK ((len([CAR_UNI]) > 0)))
CREATE TABLE CATEGLIC ( 
CAT_ID INT NOT NULL,
CAT_NOM VARCHAR(30) NOT NULL
 CONSTRAINT PK_CATEGLIC PRIMARY KEY CLUSTERED (CAT_ID))
CREATE TABLE CENTROCOSTO ( 
CCT_COD VARCHAR(3) NOT NULL,
CCT_DES VARCHAR(30)
 CONSTRAINT PK_CENTROCOSTO PRIMARY KEY CLUSTERED (CCT_COD),
 CONSTRAINT CK__CENTROCOS__CCT_C__0BC6C43E CHECK ((len([CCT_COD]) > 0)))
CREATE TABLE CIUDADES ( 
CIU_COD VARCHAR(8) NOT NULL,
CIU_DES VARCHAR(30) NOT NULL,
CIU_DEP VARCHAR(4) NOT NULL,
CIU_ICA DECIMAL(10,4) DEFAULT (0),
CIU_OTR DECIMAL(10,4) DEFAULT (0),
CIU_HOR SMALLINT DEFAULT (0),
CIU_CLV VARCHAR(10),
CIU_ARI BIT DEFAULT ((0)) NOT NULL,
CIU_CIC VARCHAR(3)
 CONSTRAINT PK_CIUDADES PRIMARY KEY CLUSTERED (CIU_COD),
 CONSTRAINT CK__CIUDADES__CIU_CO__0EA330E9 CHECK ((len([CIU_COD]) > 0)),
 CONSTRAINT CK__CIUDADES__CIU_DE__0F975522 CHECK ((len([CIU_DES]) > 0)),
 CONSTRAINT CK__CIUDADES__CIU_DE__108B795B CHECK ((len([CIU_DEP]) > 0)))
CREATE TABLE CLASEPOR ( 
CLA_COD VARCHAR(3) NOT NULL,
CLA_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_CLASEPOR PRIMARY KEY CLUSTERED (CLA_COD),
 CONSTRAINT CK__CLASEPOR__CLA_CO__164452B1 CHECK ((len([CLA_COD]) > 0)),
 CONSTRAINT CK__CLASEPOR__CLA_DE__173876EA CHECK ((len([CLA_DES]) > 0)))
CREATE TABLE CLASETAS ( 
CLA_COD VARCHAR(3) NOT NULL,
CLA_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_CLASETAS PRIMARY KEY CLUSTERED (CLA_COD),
 CONSTRAINT CK__CLASETAS__CLA_CO__1A14E395 CHECK ((len([CLA_COD]) > 0)),
 CONSTRAINT CK__CLASETAS__CLA_DE__1B0907CE CHECK ((len([CLA_DES]) > 0)))
CREATE TABLE CLIFCO ( 
CFC_NIT VARCHAR(11) NOT NULL,
CFC_NOM VARCHAR(150),
CFC_DIR VARCHAR(250),
CFC_TEL VARCHAR(12),
CFC_FEC SMALLDATETIME,
CFC_EXE BIT DEFAULT (0) NOT NULL,
CFC_TIP CHAR(1) DEFAULT ('N'),
CFC_DV CHAR(1),
CFC_CIU VARCHAR(8),
CFC_TLC VARCHAR(12),
CFC_EML VARCHAR(100),
CFC_POS INT DEFAULT ((0))
 CONSTRAINT PK_CLIFCO PRIMARY KEY CLUSTERED (CFC_NIT),
 CONSTRAINT CK__CLIFCO__CFC_NIT__1DE57479 CHECK ((len([CFC_NIT]) > 0)),
 CONSTRAINT CK__CLIFCO__CFC_NOM__1ED998B2 CHECK ((len([CFC_NOM]) > 0)))
CREATE TABLE CODCUENTAS ( 
COD_TIP VARCHAR(3) NOT NULL,
COD_ID VARCHAR(3) NOT NULL,
COD_DES VARCHAR(50),
COD_ORD INT DEFAULT (0) NOT NULL
 CONSTRAINT PK_CODCUENTAS PRIMARY KEY CLUSTERED (COD_TIP,COD_ID),
 CONSTRAINT CK_CODCUENTASCOD_ID CHECK ((len([COD_ID]) > 0)),
 CONSTRAINT CK_CODCUENTASCOD_TIP CHECK ((len([COD_TIP]) > 0)))
CREATE TABLE COLORES ( 
COL_COD VARCHAR(5) NOT NULL,
COL_DES VARCHAR(50),
COL_CMT VARCHAR(6)
 CONSTRAINT PK_COLORES PRIMARY KEY CLUSTERED (COL_COD),
 CONSTRAINT CK__COLORES__COL_COD__267ABA7A CHECK ((len([COL_COD])>(0))),
 CONSTRAINT CK__COLORES__COL_DES__276EDEB3 CHECK ((len([COL_DES])>(0))))
CREATE TABLE COMBOS ( 
COM_COD VARCHAR(16) NOT NULL,
COM_ING VARCHAR(16) NOT NULL,
COM_CAN DECIMAL(14,4) DEFAULT (0)
 CONSTRAINT PK_COMBOS PRIMARY KEY CLUSTERED (COM_COD,COM_ING),
 CONSTRAINT CK__COMBOS__COM_COD__2A4B4B5E CHECK ((len([COM_COD]) > 0)),
 CONSTRAINT CK__COMBOS__COM_ING__2B3F6F97 CHECK ((len([COM_ING]) > 0)))
CREATE TABLE COMISIONES ( 
COM_ID INT DEFAULT ((0)) NOT NULL,
COM_INI DECIMAL(14,4) DEFAULT ((0)) NOT NULL,
COM_FIN DECIMAL(14,4) DEFAULT ((0)) NOT NULL,
COM_COD VARCHAR(3) NOT NULL
 CONSTRAINT PK_COMISIONES PRIMARY KEY CLUSTERED (COM_ID),
 CONSTRAINT CK_COMISIONESCOM_COD CHECK ((len([COM_COD])>(0))))
CREATE TABLE CONCEPTOS ( 
CON_COD VARCHAR(3) NOT NULL,
CON_DES VARCHAR(40) NOT NULL,
CON_TIP VARCHAR(3) NOT NULL,
CON_CMP VARCHAR(3),
CON_VCE BIT DEFAULT (0) NOT NULL,
CON_IMP BIT DEFAULT (0) NOT NULL,
CON_MEM VARCHAR(100),
CON_POR DECIMAL(10,4) DEFAULT (0),
CON_NIF VARCHAR(10),
CON_TCN VARCHAR(3),
CON_TCF VARCHAR(3),
CON_CAJ BIT DEFAULT ((0))
 CONSTRAINT PK_CONCEPTOS PRIMARY KEY CLUSTERED (CON_COD),
 CONSTRAINT CK__CONCEPTOS__CON_C__2F10007B CHECK ((len([CON_COD]) > 0)),
 CONSTRAINT CK__CONCEPTOS__CON_D__300424B4 CHECK ((len([CON_DES]) > 0)),
 CONSTRAINT CK__CONCEPTOS__CON_T__30F848ED CHECK ((len([CON_TIP]) > 0)))
CREATE TABLE CONCEPTOSCAJA ( 
CON_COD VARCHAR(3) NOT NULL,
CON_DES VARCHAR(50) NOT NULL,
CON_CUE VARCHAR(16),
CON_TIP VARCHAR(10)
 CONSTRAINT PK_CONCEPTOSCAJA PRIMARY KEY CLUSTERED (CON_COD),
 CONSTRAINT CK__CONCEPTOS__CON_C__35BCFE0A CHECK ((len([CON_COD]) > 0)),
 CONSTRAINT CK__CONCEPTOS__CON_D__36B12243 CHECK ((len([CON_DES]) > 0)))
CREATE TABLE CONCEPTOSFAC ( 
CON_COD VARCHAR(3) NOT NULL,
CON_DES VARCHAR(50),
CON_SER BIT DEFAULT (0) NOT NULL,
CON_IVA VARCHAR(3),
CON_RET BIT DEFAULT (0) NOT NULL,
CON_ING VARCHAR(16),
CON_COS VARCHAR(16),
CON_OTR VARCHAR(16),
CON_MAN BIT DEFAULT (0),
CON_PRF VARCHAR(3),
CON_CRF VARCHAR(16),
CON_CDR VARCHAR(16),
CON_CIV VARCHAR(16),
CON_CDI VARCHAR(16),
CON_CIC VARCHAR(16),
CON_CID VARCHAR(16),
CON_BOD BIT DEFAULT (0),
CON_CFE VARCHAR(20),
CON_CDG VARCHAR(16),
CON_CDO VARCHAR(16),
CON_CDC VARCHAR(16)
 CONSTRAINT PK_CONCEPTOSFAC PRIMARY KEY CLUSTERED (CON_COD),
 CONSTRAINT CK__CONCEPTOS__CON_C__398D8EEE CHECK ((len([CON_COD]) > 0)))
CREATE TABLE CONCEPTOSLEG ( 
CON_COD VARCHAR(3) NOT NULL,
CON_DES VARCHAR(50) NOT NULL,
CON_DEB VARCHAR(16),
CON_CRE VARCHAR(16),
CON_NAT CHAR(1) DEFAULT ('D'),
CON_TIP INT DEFAULT ((0))
 CONSTRAINT PK_CONCEPTOSLEG PRIMARY KEY CLUSTERED (CON_COD),
 CONSTRAINT CK__CONCEPTOS__CON_C__3E52440B CHECK ((len([CON_COD]) > 0)),
 CONSTRAINT CK__CONCEPTOS__CON_D__3F466844 CHECK ((len([CON_DES]) > 0)))
CREATE TABLE CONDPAGO ( 
CDP_NUM VARCHAR(3) NOT NULL,
CDP_PLA SMALLINT DEFAULT (0)
 CONSTRAINT PK_CONDPAGO PRIMARY KEY CLUSTERED (CDP_NUM),
 CONSTRAINT CK__CONDPAGO__CDP_NU__4316F928 CHECK ((len([CDP_NUM]) > 0)))
CREATE TABLE CONPRE ( 
CPR_TIP VARCHAR(3) NOT NULL,
CPR_CON VARCHAR(3) NOT NULL,
CPR_ID SMALLINT DEFAULT (0) NOT NULL
 CONSTRAINT PK_CONPRE PRIMARY KEY CLUSTERED (CPR_TIP,CPR_CON,CPR_ID),
 CONSTRAINT CK__CONPRE__CPR_CON__47DBAE45 CHECK ((len([CPR_CON]) > 0)),
 CONSTRAINT CK__CONPRE__CPR_TIP__46E78A0C CHECK ((len([CPR_TIP]) > 0)))
CREATE TABLE CONSCOM ( 
CON_TIP VARCHAR(3) NOT NULL,
CON_CIA CHAR(2) DEFAULT ('01') NOT NULL,
CON_NUM INT DEFAULT (0),
CON_RES VARCHAR(3)
 CONSTRAINT PK_CONSCOM PRIMARY KEY CLUSTERED (CON_TIP,CON_CIA),
 CONSTRAINT CK__CONSCOM__CON_CIA__4D94879B CHECK ((len([CON_CIA]) > 0)),
 CONSTRAINT CK__CONSCOM__CON_TIP__4BAC3F29 CHECK ((len([CON_TIP]) > 0)))
CREATE TABLE CONSDOC ( 
CON_TIP VARCHAR(3) NOT NULL,
CON_CIA CHAR(2) DEFAULT ('01') NOT NULL,
CON_NUM INT DEFAULT (0),
CON_RES VARCHAR(20),
CON_FEC SMALLDATETIME,
CON_RAN VARCHAR(30),
CON_PRE VARCHAR(5),
CON_AUT BIT DEFAULT (1) NOT NULL,
CON_LOT BIT DEFAULT (0) NOT NULL,
CON_FOR VARCHAR(20),
CON_SEP VARCHAR(5),
CON_FAB VARCHAR(5),
CON_FVR SMALLDATETIME,
CON_CVT VARCHAR(250),
CON_RDS VARCHAR(3)
 CONSTRAINT PK_CONSDOC PRIMARY KEY CLUSTERED (CON_TIP,CON_CIA),
 CONSTRAINT CK__CONSDOC__CON_CIA__534D60F1 CHECK ((len([CON_CIA]) > 0)),
 CONSTRAINT CK__CONSDOC__CON_TIP__5165187F CHECK ((len([CON_TIP]) > 0)))
CREATE TABLE CONTRATOS ( 
CON_NUM INT DEFAULT (0) NOT NULL,
CON_FEC SMALLDATETIME NOT NULL,
CON_FVC SMALLDATETIME,
CON_NIT VARCHAR(11) NOT NULL,
CON_ORI VARCHAR(8) NOT NULL,
CON_DES VARCHAR(8) NOT NULL,
CON_CAR VARCHAR(13) NOT NULL,
CON_KIL DECIMAL(14,4) DEFAULT (0),
CON_MOD VARCHAR(20),
CON_COS MONEY DEFAULT (0),
CON_VAL MONEY DEFAULT (0),
CON_PAG MONEY DEFAULT (0),
CON_POR DECIMAL(14,4) DEFAULT (0) NOT NULL,
CON_FOR CHAR(1) DEFAULT ('%') NOT NULL,
CON_OBS VARCHAR(250),
CON_INA BIT DEFAULT (0) NOT NULL
 CONSTRAINT PK_CONTRATOS PRIMARY KEY CLUSTERED (CON_NUM),
 CONSTRAINT CK_CONTRATOSCON_CAR CHECK ((len([CON_CAR]) > 0)),
 CONSTRAINT CK_CONTRATOSCON_DES CHECK ((len([CON_DES]) > 0)),
 CONSTRAINT CK_CONTRATOSCON_FOR CHECK ((len([CON_FOR]) > 0)),
 CONSTRAINT CK_CONTRATOSCON_NIT CHECK ((len([CON_NIT]) > 0)),
 CONSTRAINT CK_CONTRATOSCON_ORI CHECK ((len([CON_ORI]) > 0)))
CREATE TABLE CORTES ( 
COR_FEC SMALLDATETIME NOT NULL,
COR_NUM SMALLINT DEFAULT (0) NOT NULL,
COR_PLA INT DEFAULT (0),
COR_CIA CHAR(2) DEFAULT ('01'),
COR_CER BIT DEFAULT (0) NOT NULL
 CONSTRAINT PK_CORTES PRIMARY KEY CLUSTERED (COR_FEC,COR_NUM))
CREATE TABLE CUEBOMB ( 
BOM_TIP VARCHAR(3) NOT NULL,
BOM_COD VARCHAR(3) NOT NULL,
BOM_CUE VARCHAR(16) NOT NULL
 CONSTRAINT PK_CUEBOMB PRIMARY KEY CLUSTERED (BOM_TIP,BOM_COD),
 CONSTRAINT CK_CUEBOMBBOM_COD CHECK ((len([BOM_COD])>(0))),
 CONSTRAINT CK_CUEBOMBBOM_CUE CHECK ((len([BOM_CUE])>(0))),
 CONSTRAINT CK_CUEBOMBBOM_TIP CHECK ((len([BOM_TIP])>(0))))
CREATE TABLE CUECON ( 
CUE_COD VARCHAR(3) NOT NULL,
CUE_CON VARCHAR(3) NOT NULL,
CUE_NUM VARCHAR(16),
CUE_MOV CHAR(1) DEFAULT ('D'),
CUE_DES VARCHAR(30),
CUE_CC VARCHAR(3),
CUE_TIP VARCHAR(3)
 CONSTRAINT PK_CUECON PRIMARY KEY CLUSTERED (CUE_COD,CUE_CON),
 CONSTRAINT CK__CUECON__CUE_COD__5CD6CB2B CHECK ((len([CUE_COD]) > 0)),
 CONSTRAINT CK__CUECON__CUE_CON__5DCAEF64 CHECK ((len([CUE_CON]) > 0)))
CREATE TABLE CUECREE ( 
RET_TIP VARCHAR(3) NOT NULL,
RET_COD VARCHAR(3) NOT NULL,
RET_CUE VARCHAR(16) NOT NULL
 CONSTRAINT PK_CUECREE PRIMARY KEY CLUSTERED (RET_TIP,RET_COD),
 CONSTRAINT CK_CUECREERET_COD CHECK ((len([RET_COD])>(0))),
 CONSTRAINT CK_CUECREERET_CUE CHECK ((len([RET_CUE])>(0))),
 CONSTRAINT CK_CUECREERET_TIP CHECK ((len([RET_TIP])>(0))))
CREATE TABLE CUEICA ( 
ICA_TIP VARCHAR(3) NOT NULL,
ICA_CIU VARCHAR(8) NOT NULL,
ICA_CUE VARCHAR(16) NOT NULL,
ICA_IAT VARCHAR(16)
 CONSTRAINT PK_CUEICA PRIMARY KEY CLUSTERED (ICA_TIP,ICA_CIU),
 CONSTRAINT CK_CUEICAICA_CIU CHECK ((len([ICA_CIU]) > 0)),
 CONSTRAINT CK_CUEICAICA_CUE CHECK ((len([ICA_CUE]) > 0)),
 CONSTRAINT CK_CUEICAICA_TIP CHECK ((len([ICA_TIP]) > 0)))
CREATE TABLE CUENTASDEPAGO ( 
CTA_COD VARCHAR(3) NOT NULL,
CTA_NUM VARCHAR(20) NOT NULL,
CTA_BAN VARCHAR(3),
CTA_PUC VARCHAR(16),
CTA_FOR VARCHAR(20),
CTA_AUT BIT DEFAULT (0),
CTA_CON INT DEFAULT (0),
CTA_RAN VARCHAR(20)
 CONSTRAINT PK_CUENTASDEPAGO PRIMARY KEY CLUSTERED (CTA_COD),
 CONSTRAINT CK__CUENTASDE__CTA_C__619B8048 CHECK ((len([CTA_COD]) > 0)),
 CONSTRAINT CK__CUENTASDE__CTA_N__628FA481 CHECK ((len([CTA_NUM]) > 0)))
CREATE TABLE DEPARTAMENTOS ( 
DEP_COD VARCHAR(4) NOT NULL,
DEP_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_DEPARTAMENTOS PRIMARY KEY CLUSTERED (DEP_COD),
 CONSTRAINT CK__DEPARTAME__DEP_C__6754599E CHECK ((len([DEP_COD]) > 0)),
 CONSTRAINT CK__DEPARTAME__DEP_D__68487DD7 CHECK ((len([DEP_DES]) > 0)))
CREATE TABLE DIARIOS ( 
DIA_COD VARCHAR(3) NOT NULL,
DIA_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_DIARIOS PRIMARY KEY CLUSTERED (DIA_COD),
 CONSTRAINT CK__DIARIOS__DIA_COD__6B24EA82 CHECK ((len([DIA_COD]) > 0)),
 CONSTRAINT CK__DIARIOS__DIA_DES__6C190EBB CHECK ((len([DIA_DES]) > 0)))
CREATE TABLE EMPAQUES ( 
EMP_COD VARCHAR(3) NOT NULL,
EMP_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_EMPAQUES PRIMARY KEY CLUSTERED (EMP_COD),
 CONSTRAINT CK__EMPAQUES__EMP_CO__6EF57B66 CHECK ((len([EMP_COD]) > 0)),
 CONSTRAINT CK__EMPAQUES__EMP_DE__6FE99F9F CHECK ((len([EMP_DES]) > 0)))
CREATE TABLE ESTRATOS ( 
EST_COD VARCHAR(3) NOT NULL,
EST_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_ESTRATOS PRIMARY KEY CLUSTERED (EST_COD),
 CONSTRAINT CK__ESTRATOS__EST_CO__72C60C4A CHECK ((len([EST_COD]) > 0)),
 CONSTRAINT CK__ESTRATOS__EST_DE__73BA3083 CHECK ((len([EST_DES]) > 0)))
CREATE TABLE ESTSERIAL ( 
EST_COD VARCHAR(3) NOT NULL,
EST_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_ESTSERIAL PRIMARY KEY CLUSTERED (EST_COD),
 CONSTRAINT CK__ESTSERIAL__EST_C__76969D2E CHECK ((len([EST_COD]) > 0)),
 CONSTRAINT CK__ESTSERIAL__EST_D__778AC167 CHECK ((len([EST_DES]) > 0)))
CREATE TABLE GASTOSVIAJE ( 
GAS_ID INT DEFAULT (0) NOT NULL,
GAS_ITM SMALLINT DEFAULT (0) NOT NULL,
GAS_CON VARCHAR(3) NOT NULL,
GAS_VAL MONEY DEFAULT (0) NOT NULL
 CONSTRAINT PK_GASTOSVIAJE PRIMARY KEY CLUSTERED (GAS_ID,GAS_ITM),
 CONSTRAINT CK__GASTOSVIA__GAS_C__7C4F7684 CHECK ((len([GAS_CON]) > 0)))
CREATE TABLE GRUPOS ( 
GRU_COD VARCHAR(3) NOT NULL,
GRU_DES VARCHAR(30) NOT NULL,
GRU_LIN VARCHAR(3) NOT NULL,
GRU_IVA VARCHAR(3),
GRU_DCT VARCHAR(3)
 CONSTRAINT PK_GRUPOS PRIMARY KEY CLUSTERED (GRU_COD),
 CONSTRAINT CK__GRUPOS__GRU_COD__00200768 CHECK ((len([GRU_COD]) > 0)),
 CONSTRAINT CK__GRUPOS__GRU_DES__01142BA1 CHECK ((len([GRU_DES]) > 0)),
 CONSTRAINT CK__GRUPOS__GRU_LIN__02084FDA CHECK ((len([GRU_LIN]) > 0)))
CREATE TABLE INFINANCIEROS ( 
INF_COD VARCHAR(3) NOT NULL,
INF_DES VARCHAR(100) NOT NULL,
INF_TIP VARCHAR(10) DEFAULT ('CG')
 CONSTRAINT PK_INFINANCIEROS PRIMARY KEY CLUSTERED (INF_COD),
 CONSTRAINT CK_INFINANCIEROSINF_COD CHECK ((len([INF_COD]) > 0)),
 CONSTRAINT CK_INFINANCIEROSINF_DES CHECK ((len([INF_DES]) > 0)))
CREATE TABLE INFINCONCEPTOS ( 
CON_INF VARCHAR(3) NOT NULL,
CON_COD VARCHAR(3) NOT NULL,
CON_DES VARCHAR(150),
CON_GRU VARCHAR(3) NOT NULL,
CON_TIP VARCHAR(10) DEFAULT ('CUENTAS') NOT NULL,
CON_IND INT DEFAULT (0) NOT NULL
 CONSTRAINT PK_INFINCONCEPTOS PRIMARY KEY CLUSTERED (CON_INF,CON_COD),
 CONSTRAINT CK_INFINCONCEPTOSCON_COD CHECK ((len([CON_COD]) > 0)),
 CONSTRAINT CK_INFINCONCEPTOSCON_GRU CHECK ((len([CON_GRU]) > 0)),
 CONSTRAINT CK_INFINCONCEPTOSCON_INF CHECK ((len([CON_INF]) > 0)),
 CONSTRAINT CK_INFINCONCEPTOSCON_TIP CHECK ((len([CON_TIP]) > 0)))
CREATE TABLE INFINCUENTAS ( 
CUE_INF VARCHAR(3) NOT NULL,
CUE_CON VARCHAR(3) NOT NULL,
CUE_IND INT DEFAULT (0) NOT NULL,
CUE_OPE VARCHAR(10) NOT NULL,
CUE_UNI CHAR(1) DEFAULT ('+') NOT NULL,
CUE_INI VARCHAR(250),
CUE_FIN VARCHAR(50),
CUE_COL VARCHAR(50)
 CONSTRAINT PK_INFINCUENTAS PRIMARY KEY CLUSTERED (CUE_INF,CUE_CON,CUE_IND),
 CONSTRAINT CK_INFINCUENTASCUE_CON CHECK ((len([CUE_CON]) > 0)),
 CONSTRAINT CK_INFINCUENTASCUE_INF CHECK ((len([CUE_INF]) > 0)),
 CONSTRAINT CK_INFINCUENTASCUE_OPE CHECK ((len([CUE_OPE]) > 0)),
 CONSTRAINT CK_INFINCUENTASCUE_UNI CHECK ((len([CUE_UNI]) > 0)))
CREATE TABLE INFINGRUPOS ( 
GRU_INF VARCHAR(3) NOT NULL,
GRU_COD VARCHAR(3) NOT NULL,
GRU_DES VARCHAR(100) NOT NULL
 CONSTRAINT PK_INFINGRUPOS PRIMARY KEY CLUSTERED (GRU_INF,GRU_COD),
 CONSTRAINT CK_INFINGRUPOSGRU_COD CHECK ((len([GRU_COD]) > 0)),
 CONSTRAINT CK_INFINGRUPOSGRU_DES CHECK ((len([GRU_DES]) > 0)),
 CONSTRAINT CK_INFINGRUPOSGRU_INF CHECK ((len([GRU_INF]) > 0)))
CREATE TABLE LIBROS ( 
LIB_COD VARCHAR(3) NOT NULL,
LIB_DES VARCHAR(50) NOT NULL,
LIB_INI INT DEFAULT (0),
LIB_FIN INT DEFAULT (0)
 CONSTRAINT PK_LIBROS PRIMARY KEY CLUSTERED (LIB_COD),
 CONSTRAINT CK__LIBROS__LIB_COD__04E4BC85 CHECK ((len([LIB_COD]) > 0)),
 CONSTRAINT CK__LIBROS__LIB_DES__05D8E0BE CHECK ((len([LIB_DES]) > 0)))
CREATE TABLE LINCARGA ( 
LIN_COD VARCHAR(6) NOT NULL,
LIN_DES VARCHAR(250)
 CONSTRAINT PK_LINCARGA PRIMARY KEY CLUSTERED (LIN_COD),
 CONSTRAINT CK__LINCARGA__LIN_CO__0A9D95DB CHECK ((len([LIN_COD]) > 0)))
CREATE TABLE LINEAS ( 
LIN_COD VARCHAR(3) NOT NULL,
LIN_DES VARCHAR(30) NOT NULL,
LIN_IVA VARCHAR(3) NOT NULL,
LIN_DCT VARCHAR(3) NOT NULL
 CONSTRAINT PK_LINEAS PRIMARY KEY CLUSTERED (LIN_COD),
 CONSTRAINT CK__LINEAS__LIN_COD__0D7A0286 CHECK ((len([LIN_COD]) > 0)),
 CONSTRAINT CK__LINEAS__LIN_DCT__10566F31 CHECK ((len([LIN_DCT]) > 0)),
 CONSTRAINT CK__LINEAS__LIN_DES__0E6E26BF CHECK ((len([LIN_DES]) > 0)),
 CONSTRAINT CK__LINEAS__LIN_IVA__0F624AF8 CHECK ((len([LIN_IVA]) > 0)))
CREATE TABLE LINEAVEH ( 
LIN_COD VARCHAR(7) NOT NULL,
LIN_MAR VARCHAR(4),
LIN_CON VARCHAR(4),
LIN_DES VARCHAR(50),
LIN_CMT VARCHAR(10)
 CONSTRAINT PK_LINEAVEH PRIMARY KEY CLUSTERED (LIN_COD),
 CONSTRAINT CK__LINEAVEH__LIN_CO__1332DBDC CHECK ((len([LIN_COD]) > 0)),
 CONSTRAINT CK__LINEAVEH__LIN_CO__151B244E CHECK ((len([LIN_CON]) > 0)),
 CONSTRAINT CK__LINEAVEH__LIN_DE__160F4887 CHECK ((len([LIN_DES]) > 0)),
 CONSTRAINT CK__LINEAVEH__LIN_MA__14270015 CHECK ((len([LIN_MAR]) > 0)))
CREATE TABLE MARCAS ( 
MAR_COD VARCHAR(4) NOT NULL,
MAR_DES VARCHAR(50),
MAR_CMT VARCHAR(6)
 CONSTRAINT PK_MARCAS PRIMARY KEY CLUSTERED (MAR_COD),
 CONSTRAINT CK__MARCAS__MAR_COD__18EBB532 CHECK ((len([MAR_COD])>(0))),
 CONSTRAINT CK__MARCAS__MAR_DES__19DFD96B CHECK ((len([MAR_DES])>(0))))
CREATE TABLE MARCASREM ( 
MAR_COD VARCHAR(4) NOT NULL,
MAR_DES VARCHAR(50),
MAR_CMT VARCHAR(6)
 CONSTRAINT PK_MARCASREM PRIMARY KEY CLUSTERED (MAR_COD),
 CONSTRAINT CK_MARCASREMMAR_DES CHECK ((len([MAR_DES])>(0))))
CREATE TABLE MUDBODEGAS ( 
BOD_COD VARCHAR(3) NOT NULL,
BOD_DES VARCHAR(100) NOT NULL,
BOD_DIR VARCHAR(100),
BOD_TEL VARCHAR(50)
 CONSTRAINT PK_MUDBODEGAS PRIMARY KEY CLUSTERED (BOD_COD),
 CONSTRAINT CK_MUDBODEGASBOD_COD CHECK ((len([BOD_COD]) > 0)),
 CONSTRAINT CK_MUDBODEGASBOD_DES CHECK ((len([BOD_DES]) > 0)))
CREATE TABLE MUDRUTAS ( 
TAR_ORI VARCHAR(8) NOT NULL,
TAR_DES VARCHAR(8) NOT NULL,
TAR_VAL MONEY DEFAULT (0) NOT NULL
 CONSTRAINT PK_MUDRUTAS PRIMARY KEY CLUSTERED (TAR_ORI,TAR_DES),
 CONSTRAINT CK_MUDRUTASTAR_DES CHECK ((len([TAR_DES]) > 0)),
 CONSTRAINT CK_MUDRUTASTAR_ORI CHECK ((len([TAR_ORI]) > 0)))
CREATE TABLE MUDTARIFAS ( 
TAR_NUM INT DEFAULT (0) NOT NULL,
TAR_TRA VARCHAR(10) NOT NULL,
TAR_TIP VARCHAR(10) NOT NULL,
TAR_SER VARCHAR(20) NOT NULL,
TAR_HOR VARCHAR(50) NOT NULL,
TAR_GLO BIT DEFAULT (0) NOT NULL,
TAR_VAL MONEY DEFAULT (0) NOT NULL,
TAR_DES BIT DEFAULT (0) NOT NULL
 CONSTRAINT PK_MUDTARIFAS PRIMARY KEY CLUSTERED (TAR_NUM),
 CONSTRAINT CK_MUDTARIFASTAR_HOR CHECK ((len([TAR_HOR]) > 0)),
 CONSTRAINT CK_MUDTARIFASTAR_SER CHECK ((len([TAR_SER]) > 0)),
 CONSTRAINT CK_MUDTARIFASTAR_TIP CHECK ((len([TAR_TIP]) > 0)),
 CONSTRAINT CK_MUDTARIFASTAR_TRA CHECK ((len([TAR_TRA]) > 0)))
CREATE TABLE NATURALEZAS ( 
NAT_COD VARCHAR(3) NOT NULL,
NAT_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_NATURALEZAS PRIMARY KEY CLUSTERED (NAT_COD),
 CONSTRAINT CK__NATURALEZ__NAT_C__1CBC4616 CHECK ((len([NAT_COD]) > 0)),
 CONSTRAINT CK__NATURALEZ__NAT_D__1DB06A4F CHECK ((len([NAT_DES]) > 0)))
CREATE TABLE NIIFTASAS ( 
TAS_ID INT IDENTITY ( 1,1 ) NOT NULL,
TAS_TIP VARCHAR(3) DEFAULT ('CXC') NOT NULL,
TAS_INI DECIMAL(14,4) DEFAULT ((0)) NOT NULL,
TAS_FIN DECIMAL(14,4) DEFAULT ((0)) NOT NULL,
TAS_COD VARCHAR(3) NOT NULL
 CONSTRAINT PK_NIIFTASAS PRIMARY KEY CLUSTERED (TAS_ID),
 CONSTRAINT CK_NIIFTASASTAS_COD CHECK ((len([TAS_COD])>(0))),
 CONSTRAINT CK_NIIFTASASTAS_TIP CHECK ((len([TAS_TIP])>(0))))
CREATE TABLE NIT ( 
NIT_NIT VARCHAR(11) NOT NULL,
NIT_NOM VARCHAR(150) NOT NULL,
NIT_COD VARCHAR(11) NOT NULL,
NIT_TIP VARCHAR(1) DEFAULT ('N') NOT NULL,
NIT_DV VARCHAR(1),
NIT_REP VARCHAR(100),
NIT_DIR VARCHAR(250),
NIT_CIU VARCHAR(8),
NIT_TEL VARCHAR(12),
NIT_TLC VARCHAR(12),
NIT_FAX VARCHAR(12),
NIT_URL VARCHAR(100),
NIT_EML VARCHAR(100),
NIT_ACT VARCHAR(8),
NIT_REG VARCHAR(3) DEFAULT ('001'),
NIT_CDP VARCHAR(3),
NIT_CLI BIT DEFAULT (0) NOT NULL,
NIT_VEN BIT DEFAULT (0) NOT NULL,
NIT_CDT BIT DEFAULT (0) NOT NULL,
NIT_ZON VARCHAR(3),
NIT_SUB VARCHAR(3),
NIT_CRE MONEY DEFAULT (0),
NIT_CVE VARCHAR(11),
NIT_DCT VARCHAR(3),
NIT_EXE BIT DEFAULT (0) NOT NULL,
NIT_INT BIT DEFAULT (0) NOT NULL,
NIT_SOL BIT DEFAULT (0) NOT NULL,
NIT_RET BIT DEFAULT (0) NOT NULL,
NIT_CUO BIT DEFAULT (0) NOT NULL,
NIT_EST VARCHAR(3),
NIT_SAL MONEY DEFAULT (0),
NIT_CMV VARCHAR(3),
NIT_CMC VARCHAR(3),
NIT_LUG VARCHAR(15),
NIT_FOT VARCHAR(20),
NIT_LIC VARCHAR(20),
NIT_LDE VARCHAR(20),
NIT_CAT SMALLINT DEFAULT (0),
NIT_VIG SMALLDATETIME,
NIT_VET BIT DEFAULT (0) NOT NULL,
NIT_OBS VARCHAR(100),
NIT_BLO BIT DEFAULT (0) NOT NULL,
NIT_FEC SMALLDATETIME,
NIT_FIR VARCHAR(20),
NIT_PRF VARCHAR(3),
NIT_FLE BIT DEFAULT (0) NOT NULL,
NIT_TCU VARCHAR(10),
NIT_CTA VARCHAR(20),
NIT_BAN VARCHAR(3),
NIT_POS INT DEFAULT (0),
NIT_FAC INT DEFAULT (0),
NIT_FAL BIT DEFAULT (0),
NIT_JUD VARCHAR(20),
NIT_VCJ SMALLDATETIME,
NIT_PEN VARCHAR(50),
NIT_EPS VARCHAR(50),
NIT_ARP VARCHAR(50),
NIT_PRV BIT DEFAULT (0),
NIT_PRO BIT DEFAULT (0),
NIT_ACC BIT DEFAULT (0),
NIT_DGR INT DEFAULT (0),
NIT_PZS VARCHAR(5),
NIT_PZG VARCHAR(5),
NIT_FPP SMALLDATETIME,
NIT_FPS SMALLDATETIME,
NIT_FPA SMALLDATETIME,
NIT_PAG VARCHAR(20) DEFAULT ('CHEQUE'),
NIT_SED VARCHAR(4),
NIT_NSE VARCHAR(50),
NIT_ART BIT DEFAULT ((0)),
NIT_LTA INT DEFAULT ((0)),
NIT_CTJ BIT DEFAULT ((0)),
NIT_NTJ VARCHAR(50),
NIT_RFE BIT DEFAULT(0) NOT NULL
 CONSTRAINT PK_NIT PRIMARY KEY CLUSTERED (NIT_NIT),
 CONSTRAINT CK__NIT__NIT_COD__22751F6C CHECK ((len([NIT_COD]) > 0)),
 CONSTRAINT CK__NIT__NIT_NIT__208CD6FA CHECK ((len([NIT_NIT]) > 0)),
 CONSTRAINT CK__NIT__NIT_NOM__2180FB33 CHECK ((len([NIT_NOM]) > 0)),
 CONSTRAINT CK__NIT__NIT_TIP__245D67DE CHECK ((len([NIT_TIP]) > 0)))
CREATE TABLE NIT_CONTACTOS ( 
CNT_NIT VARCHAR(11) NOT NULL,
CNT_ITM INT DEFAULT ((0)) NOT NULL,
CNT_NOM VARCHAR(250),
CNT_TEL VARCHAR(30),
CNT_EML VARCHAR(150),
CNT_CAR VARCHAR(50),
CNT_TDC VARCHAR(10)
 CONSTRAINT PK_NIT_CONTACTOS PRIMARY KEY CLUSTERED (CNT_NIT,CNT_ITM),
 CONSTRAINT CK_NIT_CONTACTOSCNT_NIT CHECK ((len([CNT_NIT])>(0))))
CREATE TABLE NIT_RESFISCAL ( 
TRF_ID INT IDENTITY ( 1,1 ) NOT NULL,
TRF_NIT VARCHAR(11) NOT NULL,
TRF_COD VARCHAR(10) NOT NULL,
TRF_INA BIT DEFAULT ((0)) NOT NULL
 CONSTRAINT PK_NIT_RESFISCAL PRIMARY KEY CLUSTERED (TRF_ID),
 CONSTRAINT CK_NIT_RESFISCALTRF_COD CHECK ((len([TRF_COD])>(0))),
 CONSTRAINT CK_NIT_RESFISCALTRF_NIT CHECK ((len([TRF_NIT])>(0))))
CREATE TABLE NIT_SEDES ( 
SED_NIT VARCHAR(11) NOT NULL,
SED_COD VARCHAR(4) NOT NULL,
SED_NOM VARCHAR(50) NOT NULL,
SED_CIU VARCHAR(8),
SED_DIR VARCHAR(250),
SED_TEL VARCHAR(20),
SED_LAT DECIMAL(16,10) DEFAULT ((0)) NOT NULL,
SED_LNG DECIMAL(16,10) DEFAULT ((0)) NOT NULL
 CONSTRAINT PK_NIT_SEDES PRIMARY KEY CLUSTERED (SED_NIT,SED_COD),
 CONSTRAINT CK_NIT_SEDESSED_COD CHECK ((len([SED_COD])>(0))),
 CONSTRAINT CK_NIT_SEDESSED_NIT CHECK ((len([SED_NIT])>(0))),
 CONSTRAINT CK_NIT_SEDESSED_NOM CHECK ((len([SED_NOM])>(0))))
CREATE TABLE ORGTRANSITO ( 
OGT_COD VARCHAR(4) NOT NULL,
OGT_NOM VARCHAR(250) NOT NULL,
OGT_CIU VARCHAR(8) NOT NULL
 CONSTRAINT PK_ORGTRANSITO PRIMARY KEY CLUSTERED (OGT_COD),
 CONSTRAINT CK_ORGTRANSITOOGT_CIU CHECK ((len([OGT_CIU])>(0))),
 CONSTRAINT CK_ORGTRANSITOOGT_COD CHECK ((len([OGT_COD])>(0))),
 CONSTRAINT CK_ORGTRANSITOOGT_NOM CHECK ((len([OGT_NOM])>(0))))
CREATE TABLE PAGCUE ( 
PAG_COD VARCHAR(3) NOT NULL,
PAG_CON VARCHAR(3) NOT NULL,
PAG_CUE VARCHAR(16)
 CONSTRAINT PK_PAGCUE PRIMARY KEY CLUSTERED (PAG_COD,PAG_CON),
 CONSTRAINT CK__PAGCUE__PAG_COD__367C1819 CHECK ((len([PAG_COD]) > 0)),
 CONSTRAINT CK__PAGCUE__PAG_CON__37703C52 CHECK ((len([PAG_CON]) > 0)))
CREATE TABLE PEAJES ( 
PEA_ID INT DEFAULT (0) NOT NULL,
PEA_TIP VARCHAR(20) NOT NULL,
PEA_CAT VARCHAR(3) NOT NULL,
PEA_CAN INT DEFAULT (0) NOT NULL,
PEA_CON VARCHAR(3)
 CONSTRAINT PK_PEAJES PRIMARY KEY CLUSTERED (PEA_ID,PEA_TIP,PEA_CAT),
 CONSTRAINT CK__PEAJES__PEA_CAT__3C34F16F CHECK ((len([PEA_CAT]) > 0)),
 CONSTRAINT CK__PEAJES__PEA_TIP__3B40CD36 CHECK ((len([PEA_TIP]) > 0)))
CREATE TABLE POLITICASCLA ( 
CLA_ID INT DEFAULT ((0)) NOT NULL,
CLA_DES VARCHAR(100) NOT NULL
 CONSTRAINT PK_POLITICASCLA PRIMARY KEY CLUSTERED (CLA_ID),
 CONSTRAINT CK_POLITICASCLACLA_DES CHECK ((len([CLA_DES])>(0))))
CREATE TABLE POLITICASCUE ( 
POL_ID INT DEFAULT ((0)) NOT NULL,
POL_CUE VARCHAR(16) NOT NULL
 CONSTRAINT PK_POLITICASCUE PRIMARY KEY CLUSTERED (POL_ID,POL_CUE))
CREATE TABLE POLITICASNIIF ( 
POL_ID INT DEFAULT ((0)) NOT NULL,
POL_DES VARCHAR(250) NOT NULL,
POL_CLA VARCHAR(100) NOT NULL,
POL_OBJ VARCHAR(1000),
POL_ALC VARCHAR(2500),
POL_REC VARCHAR(2500),
POL_MED VARCHAR(2000) NOT NULL,
POL_MPO VARCHAR(2000),
POL_VIG INT DEFAULT ((0)) NOT NULL,
POL_DVG VARCHAR(250),
POL_OBS VARCHAR(1000),
POL_ANX VARCHAR(150),
POL_INA BIT DEFAULT ((0)) NOT NULL,
POL_FCR SMALLDATETIME NOT NULL,
POL_USU VARCHAR(8) NOT NULL
 CONSTRAINT PK_POLITICASNIIF PRIMARY KEY CLUSTERED (POL_ID),
 CONSTRAINT CK_POLITICASNIIFPOL_CLA CHECK ((len([POL_CLA])>(0))),
 CONSTRAINT CK_POLITICASNIIFPOL_DES CHECK ((len([POL_DES])>(0))),
 CONSTRAINT CK_POLITICASNIIFPOL_USU CHECK ((len([POL_USU])>(0))))
CREATE TABLE POLIZA ( 
POL_NUM VARCHAR(30) NOT NULL,
POL_COM VARCHAR(50) NOT NULL,
POL_NIT VARCHAR(11),
POL_FEC SMALLDATETIME,
POL_VCE SMALLDATETIME,
POL_TOM VARCHAR(50),
POL_NTM VARCHAR(11),
POL_TNT VARCHAR(1),
POL_ASE VARCHAR(50),
POL_NAS VARCHAR(11),
POL_TNA VARCHAR(1),
POL_BEN VARCHAR(50),
POL_NBE VARCHAR(11),
POL_TNB VARCHAR(1),
POL_EMP VARCHAR(4) DEFAULT ('0000') NOT NULL,
POL_TER VARCHAR(3) DEFAULT ('000') NOT NULL,
POL_TIP VARCHAR(3) DEFAULT ('PLT'),
POL_FM1 VARCHAR(250),
POL_FM2 VARCHAR(250)
 CONSTRAINT PK_POLIZA PRIMARY KEY CLUSTERED (POL_NUM),
 CONSTRAINT CK__POLIZA__POL_COM__40F9A68C CHECK ((len([POL_COM]) > 0)),
 CONSTRAINT CK__POLIZA__POL_EMP__42E1EEFE CHECK ((len([POL_EMP]) > 0)),
 CONSTRAINT CK__POLIZA__POL_NUM__40058253 CHECK ((len([POL_NUM]) > 0)),
 CONSTRAINT CK__POLIZA__POL_TER__44CA3770 CHECK ((len([POL_TER]) > 0)))
CREATE TABLE PRESANT ( 
PRE_ID INT DEFAULT (0) NOT NULL,
PRE_MOT VARCHAR(3) NOT NULL,
PRE_ORI VARCHAR(8) NOT NULL,
PRE_DES VARCHAR(8) NOT NULL,
PRE_RAN VARCHAR(3) NOT NULL,
PRE_COM VARCHAR(3) NOT NULL,
PRE_CAT VARCHAR(3) NOT NULL,
PRE_GAL DECIMAL(14,4) DEFAULT (0),
PRE_KMT DECIMAL(14,4) DEFAULT (0),
PRE_RUT VARCHAR(3),
PRE_TVH VARCHAR(3),
PRE_AFI VARCHAR(10)
 CONSTRAINT PK_PRESANT PRIMARY KEY CLUSTERED (PRE_ID),
 CONSTRAINT CK__PRESANT__PRE_CAT__4E53A1AA CHECK ((len([PRE_CAT]) > 0)),
 CONSTRAINT CK__PRESANT__PRE_COM__4D5F7D71 CHECK ((len([PRE_COM]) > 0)),
 CONSTRAINT CK__PRESANT__PRE_DES__4B7734FF CHECK ((len([PRE_DES]) > 0)),
 CONSTRAINT CK__PRESANT__PRE_MOT__498EEC8D CHECK ((len([PRE_MOT]) > 0)),
 CONSTRAINT CK__PRESANT__PRE_ORI__4A8310C6 CHECK ((len([PRE_ORI]) > 0)),
 CONSTRAINT CK__PRESANT__PRE_RAN__4C6B5938 CHECK ((len([PRE_RAN]) > 0)))
CREATE TABLE PRODESTANDARES ( 
Id INT IDENTITY ( 1,1 ) NOT NULL,
Codigo VARCHAR(20) NOT NULL,
Descripcion VARCHAR(500) NOT NULL
 CONSTRAINT PK_PRODESTANDARES PRIMARY KEY NONCLUSTERED (Id),
 CONSTRAINT CK_ProdEstandaresCodigo CHECK ((len([Codigo])>(0))),
 CONSTRAINT CK_ProdEstandaresDescripcion CHECK ((len([Descripcion])>(0))))
CREATE TABLE PUC ( 
PUC_COD VARCHAR(16) NOT NULL,
PUC_DES VARCHAR(60) NOT NULL,
PUC_CLV VARCHAR(6),
PUC_FEC SMALLDATETIME,
PUC_MAY BIT DEFAULT (0) NOT NULL,
PUC_MOV BIT DEFAULT (0) NOT NULL,
PUC_BAN BIT DEFAULT (0) NOT NULL,
PUC_NIT BIT DEFAULT (0) NOT NULL,
PUC_BAS BIT DEFAULT (0) NOT NULL,
PUC_VEN BIT DEFAULT (0) NOT NULL,
PUC_NAT CHAR(1) DEFAULT ('D') NOT NULL,
PUC_AJU BIT DEFAULT (0) NOT NULL,
PUC_AJD VARCHAR(16) DEFAULT ('0'),
PUC_AJC VARCHAR(16) DEFAULT ('0'),
PUC_CC BIT DEFAULT (0) NOT NULL,
PUC_TAR DECIMAL(14,4) DEFAULT (0),
PUC_NIF VARCHAR(16)
 CONSTRAINT PK_PUC PRIMARY KEY CLUSTERED (PUC_COD),
 CONSTRAINT CK__PUC__PUC_COD__531856C7 CHECK ((len([PUC_COD]) > 0)),
 CONSTRAINT CK__PUC__PUC_DES__540C7B00 CHECK ((len([PUC_DES]) > 0)),
 CONSTRAINT CK__PUC__PUC_NAT__5BAD9CC8 CHECK ((len([PUC_NAT]) > 0)))
CREATE TABLE PUCNIIF ( 
PUC_COD VARCHAR(16) NOT NULL,
PUC_DES VARCHAR(250) NOT NULL,
PUC_CLV VARCHAR(16) NOT NULL,
PUC_FEC SMALLDATETIME NOT NULL,
PUC_MAY BIT DEFAULT ((0)) NOT NULL,
PUC_MOV BIT DEFAULT ((0)) NOT NULL,
PUC_BAN BIT DEFAULT ((0)) NOT NULL,
PUC_NIT BIT DEFAULT ((0)) NOT NULL,
PUC_BAS BIT DEFAULT ((0)) NOT NULL,
PUC_VEN BIT DEFAULT ((0)) NOT NULL,
PUC_NAT CHAR(1) DEFAULT ('D') NOT NULL,
PUC_AJU BIT DEFAULT ((0)) NOT NULL,
PUC_AJD VARCHAR(16) DEFAULT ('0'),
PUC_AJC VARCHAR(16) DEFAULT ('0'),
PUC_CC BIT DEFAULT ((0)) NOT NULL,
PUC_TAR DECIMAL(14,4) DEFAULT ((0))
 CONSTRAINT PK_PUCNIIF PRIMARY KEY CLUSTERED (PUC_COD),
 CONSTRAINT CK_PUCNIIFPUC_CLV CHECK ((len([PUC_CLV])>(0))),
 CONSTRAINT CK_PUCNIIFPUC_COD CHECK ((len([PUC_COD])>(0))),
 CONSTRAINT CK_PUCNIIFPUC_DES CHECK ((len([PUC_DES])>(0))),
 CONSTRAINT CK_PUCNIIFPUC_NAT CHECK ((len([PUC_NAT])>(0))))
CREATE TABLE PUESTOS ( 
PUE_COD VARCHAR(3) NOT NULL,
PUE_DES VARCHAR(100),
PUE_CIU VARCHAR(8),
PUE_UBI VARCHAR(100),
PUE_TEL VARCHAR(20),
PUE_CEL VARCHAR(20),
PUE_CON VARCHAR(150),
PUE_TAG VARCHAR(50)
 CONSTRAINT PK_PUESTOS PRIMARY KEY CLUSTERED (PUE_COD),
 CONSTRAINT CK__PUESTOS__PUE_COD__625A9A57 CHECK ((len([PUE_COD]) > 0)),
 CONSTRAINT CK__PUESTOS__PUE_DES__634EBE90 CHECK ((len([PUE_DES]) > 0)))
CREATE TABLE RANGOSPESO ( 
RAN_COD VARCHAR(3) NOT NULL,
RAN_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_RANGOSPESO PRIMARY KEY CLUSTERED (RAN_COD),
 CONSTRAINT CK__RANGOSPES__RAN_C__662B2B3B CHECK ((len([RAN_COD]) > 0)),
 CONSTRAINT CK__RANGOSPES__RAN_D__671F4F74 CHECK ((len([RAN_DES]) > 0)))
CREATE TABLE REFCOM ( 
COM_PRO VARCHAR(16) NOT NULL,
COM_CLA VARCHAR(3) NOT NULL,
COM_NIT VARCHAR(11) DEFAULT ('0') NOT NULL,
COM_VEN VARCHAR(11) DEFAULT ('0') NOT NULL,
COM_POR DECIMAL(10,4) DEFAULT (0),
COM_COD VARCHAR(3),
COM_RAN BIT DEFAULT (0) NOT NULL,
COM_INI SMALLDATETIME,
COM_FIN SMALLDATETIME,
COM_UND CHAR(1) DEFAULT ('%')
 CONSTRAINT PK_REFCOM PRIMARY KEY CLUSTERED (COM_PRO,COM_CLA,COM_NIT,COM_VEN),
 CONSTRAINT CK__REFCOM__COM_CLA__6AEFE058 CHECK ((len([COM_CLA]) > 0)),
 CONSTRAINT CK__REFCOM__COM_NIT__6CD828CA CHECK ((len([COM_NIT]) > 0)),
 CONSTRAINT CK__REFCOM__COM_PRO__69FBBC1F CHECK ((len([COM_PRO]) > 0)),
 CONSTRAINT CK__REFCOM__COM_VEN__6EC0713C CHECK ((len([COM_VEN]) > 0)))
CREATE TABLE REFDCT ( 
DCT_PRO VARCHAR(16) NOT NULL,
DCT_CLA VARCHAR(3) NOT NULL,
DCT_NIT VARCHAR(11) DEFAULT ('0') NOT NULL,
DCT_POR DECIMAL(10,4) DEFAULT (0),
DCT_VLR BIT DEFAULT (0) NOT NULL,
DCT_COD VARCHAR(3),
DCT_RAN BIT DEFAULT (0) NOT NULL,
DCT_INI SMALLDATETIME,
DCT_FIN SMALLDATETIME
 CONSTRAINT PK_REFDCT PRIMARY KEY CLUSTERED (DCT_PRO,DCT_CLA,DCT_NIT),
 CONSTRAINT CK__REFDCT__DCT_CLA__74794A92 CHECK ((len([DCT_CLA]) > 0)),
 CONSTRAINT CK__REFDCT__DCT_NIT__76619304 CHECK ((len([DCT_NIT]) > 0)),
 CONSTRAINT CK__REFDCT__DCT_PRO__73852659 CHECK ((len([DCT_PRO]) > 0)))
CREATE TABLE REFEQUIV ( 
EQV_COD VARCHAR(16) NOT NULL,
EQV_PRO VARCHAR(16) NOT NULL,
EQV_TAN VARCHAR(3),
EQV_SEC VARCHAR(3),
EQV_TIP VARCHAR(10)
 CONSTRAINT PK_REFEQUIV PRIMARY KEY CLUSTERED (EQV_COD),
 CONSTRAINT CK_REFEQUIVEQV_COD CHECK ((len([EQV_COD]) > 0)),
 CONSTRAINT CK_REFEQUIVEQV_PRO CHECK ((len([EQV_PRO]) > 0)))
CREATE TABLE REFERENCIAS ( 
REF_COD VARCHAR(16) NOT NULL,
REF_BAR VARCHAR(16),
REF_REF VARCHAR(16),
REF_DES VARCHAR(60) NOT NULL,
REF_LIN VARCHAR(3) NOT NULL,
REF_GRU VARCHAR(3) NOT NULL,
REF_SUB VARCHAR(3) NOT NULL,
REF_MAR VARCHAR(4),
REF_COL VARCHAR(10),
REF_TAM VARCHAR(30),
REF_PRM SMALLINT DEFAULT (0),
REF_PRD SMALLINT DEFAULT (0),
REF_PRO VARCHAR(11) NOT NULL,
REF_UNI VARCHAR(3),
REF_SEC VARCHAR(3),
REF_PRA MONEY DEFAULT (0),
REF_COS MONEY DEFAULT (0) NOT NULL,
REF_CPM MONEY DEFAULT (0),
REF_PR1 MONEY DEFAULT (0),
REF_PR2 MONEY DEFAULT (0),
REF_PR3 MONEY DEFAULT (0),
REF_MIN SMALLINT DEFAULT (0),
REF_MAX INT DEFAULT (0),
REF_SAL DECIMAL(14,4) DEFAULT (0),
REF_FUC SMALLDATETIME,
REF_FUV SMALLDATETIME,
REF_INV BIT DEFAULT (0) NOT NULL,
REF_TAN BIT DEFAULT (0) NOT NULL,
REF_SER BIT DEFAULT (0) NOT NULL,
REF_LOT BIT DEFAULT (0) NOT NULL,
REF_P1D BIT DEFAULT (0) NOT NULL,
REF_P2D BIT DEFAULT (0) NOT NULL,
REF_P3D BIT DEFAULT (0) NOT NULL,
REF_COM BIT DEFAULT (0) NOT NULL,
REF_UT1 DECIMAL(10,4) DEFAULT (0),
REF_UT2 DECIMAL(10,4) DEFAULT (0),
REF_UT3 DECIMAL(10,4) DEFAULT (0),
REF_BAS VARCHAR(3),
REF_FEC SMALLDATETIME,
REF_BLO BIT DEFAULT (0) NOT NULL,
REF_RAD VARCHAR(16),
REF_ADI DECIMAL(10,4) DEFAULT (0),
REF_IVA DECIMAL(10,4) DEFAULT (0),
REF_IPV BIT DEFAULT (0) NOT NULL,
REF_DCT DECIMAL(10,4) DEFAULT (0),
REF_CAN DECIMAL(14,4) DEFAULT (0),
REF_TMP DECIMAL(14,4) DEFAULT (0),
REF_FOT VARCHAR(20),
REF_TIC VARCHAR(3),
REF_TTC CHAR(1) DEFAULT ('%'),
REF_CIT BIT DEFAULT (0),
REF_EXC BIT DEFAULT ((0)),
REF_CFE VARCHAR(20)
 CONSTRAINT PK_REFERENCIAS PRIMARY KEY CLUSTERED (REF_COD),
 CONSTRAINT CK__REFERENCI__REF_C__7C1A6C5A CHECK ((len([REF_COD]) > 0)),
 CONSTRAINT CK__REFERENCI__REF_D__7D0E9093 CHECK ((len([REF_DES]) > 0)),
 CONSTRAINT CK__REFERENCI__REF_G__7EF6D905 CHECK ((len([REF_GRU]) > 0)),
 CONSTRAINT CK__REFERENCI__REF_L__7E02B4CC CHECK ((len([REF_LIN]) > 0)),
 CONSTRAINT CK__REFERENCI__REF_P__02C769E9 CHECK ((len([REF_PRO]) > 0)),
 CONSTRAINT CK__REFERENCI__REF_S__7FEAFD3E CHECK ((len([REF_SUB]) > 0)))
CREATE TABLE REFLTAPRECIOS ( 
LTA_PRO VARCHAR(16) NOT NULL,
LTA_FEC SMALLDATETIME NOT NULL,
LTA_PR1 MONEY DEFAULT (0) NOT NULL,
LTA_PR2 MONEY DEFAULT (0) NOT NULL,
LTA_PR3 MONEY DEFAULT (0) NOT NULL,
LTA_CIA CHAR(2)
 CONSTRAINT PK_REFLTAPRECIOS PRIMARY KEY CLUSTERED (LTA_PRO,LTA_FEC),
 CONSTRAINT CK_REFLTAPRECIOSLTA_PRO CHECK ((len([LTA_PRO]) > 0)))
CREATE TABLE REFMEZCLAS ( 
MEZ_COD VARCHAR(16) NOT NULL,
MEZ_PRO VARCHAR(16) NOT NULL,
MEZ_FAC DECIMAL(10,4) DEFAULT (0) NOT NULL,
MEZ_TAN VARCHAR(3)
 CONSTRAINT PK_REFMEZCLAS PRIMARY KEY CLUSTERED (MEZ_COD,MEZ_PRO),
 CONSTRAINT CK_REFMEZCLASMEZ_COD CHECK ((len([MEZ_COD]) > 0)),
 CONSTRAINT CK_REFMEZCLASMEZ_PRO CHECK ((len([MEZ_PRO]) > 0)))
CREATE TABLE REFPRE ( 
PRE_PRO VARCHAR(16) NOT NULL,
PRE_NIT VARCHAR(11) DEFAULT ('0') NOT NULL,
PRE_AGE VARCHAR(9) DEFAULT ('0') NOT NULL,
PRE_VAL MONEY DEFAULT (0),
PRE_RAN BIT DEFAULT (0) NOT NULL,
PRE_INI SMALLDATETIME,
PRE_FIN SMALLDATETIME
 CONSTRAINT PK_REFPRE PRIMARY KEY CLUSTERED (PRE_PRO,PRE_NIT,PRE_AGE),
 CONSTRAINT CK__REFPRE__PRE_NIT__214BF109 CHECK ((len([PRE_NIT]) > 0)),
 CONSTRAINT CK__REFPRE__PRE_PRO__1F63A897 CHECK ((len([PRE_PRO]) > 0)),
 CONSTRAINT CK_REFPREPRE_AGE CHECK ((len([PRE_AGE]) > 0)))
CREATE TABLE REFTASAS ( 
TAS_PRO VARCHAR(16) NOT NULL,
TAS_CLA VARCHAR(3) NOT NULL,
TAS_MES SMALLINT DEFAULT (0) NOT NULL,
TAS_ANO SMALLINT DEFAULT (0) NOT NULL,
TAS_VAL DECIMAL(10,4) DEFAULT (0),
TAS_POR BIT DEFAULT (0) NOT NULL,
TAS_COD VARCHAR(3),
TAS_RAN BIT DEFAULT (0) NOT NULL,
TAS_INI SMALLDATETIME,
TAS_FIN SMALLDATETIME
 CONSTRAINT PK_REFTASAS PRIMARY KEY CLUSTERED (TAS_PRO,TAS_CLA,TAS_MES,TAS_ANO),
 CONSTRAINT CK__REFTASAS__TAS_CL__2704CA5F CHECK ((len([TAS_CLA]) > 0)),
 CONSTRAINT CK__REFTASAS__TAS_PR__2610A626 CHECK ((len([TAS_PRO]) > 0)))
CREATE TABLE REGIMENES ( 
REG_COD VARCHAR(3) NOT NULL,
REG_DES VARCHAR(30),
REG_FIS VARCHAR(20)
 CONSTRAINT PK_REGIMENES PRIMARY KEY CLUSTERED (REG_COD),
 CONSTRAINT CK__REGIMENES__REG_C__2EA5EC27 CHECK ((len([REG_COD]) > 0)))
CREATE TABLE RUTAPUESTO ( 
PRT_RUT VARCHAR(3) NOT NULL,
PRT_PUE VARCHAR(3) NOT NULL,
PRT_ORD SMALLINT DEFAULT (0),
PRT_DIS DECIMAL(10,4) DEFAULT (0),
PRT_TIE VARCHAR(7)
 CONSTRAINT PK_RUTAPUESTO PRIMARY KEY CLUSTERED (PRT_RUT,PRT_PUE),
 CONSTRAINT CK__RUTAPUEST__PRT_P__32767D0B CHECK ((len([PRT_PUE]) > 0)),
 CONSTRAINT CK__RUTAPUEST__PRT_R__318258D2 CHECK ((len([PRT_RUT]) > 0)))
CREATE TABLE RUTAS ( 
RUT_COD VARCHAR(3) NOT NULL,
RUT_NOM VARCHAR(100),
RUT_ORI VARCHAR(8) NOT NULL,
RUT_DES VARCHAR(8) NOT NULL,
RUT_DIS DECIMAL(10,4) DEFAULT (0),
RUT_TIE VARCHAR(7),
RUT_CMT VARCHAR(5),
RUT_FLE MONEY DEFAULT (0),
RUT_CTO VARCHAR(8),
RUT_CTD VARCHAR(8),
RUT_KTO DECIMAL(14,4) DEFAULT (0),
RUT_KTD DECIMAL(14,4) DEFAULT (0)
 CONSTRAINT PK_RUTAS PRIMARY KEY CLUSTERED (RUT_COD),
 CONSTRAINT CK__RUTAS__RUT_COD__373B3228 CHECK ((len([RUT_COD]) > 0)),
 CONSTRAINT CK__RUTAS__RUT_DES__39237A9A CHECK ((len([RUT_DES]) > 0)),
 CONSTRAINT CK__RUTAS__RUT_ORI__382F5661 CHECK ((len([RUT_ORI]) > 0)))
CREATE TABLE RUTASTRAMOS ( 
TRA_RUT VARCHAR(3) NOT NULL,
TRA_ID INT DEFAULT (0) NOT NULL,
TRA_CIU VARCHAR(8) NOT NULL,
TRA_KMS DECIMAL(14,4) DEFAULT (0) NOT NULL,
TRA_KMT DECIMAL(14,4) DEFAULT (0) NOT NULL
 CONSTRAINT PK_RUTASTRAMOS PRIMARY KEY CLUSTERED (TRA_RUT,TRA_ID),
 CONSTRAINT CK_RUTASTRAMOSTRA_CIU CHECK ((len([TRA_CIU]) > 0)),
 CONSTRAINT CK_RUTASTRAMOSTRA_RUT CHECK ((len([TRA_RUT]) > 0)))
CREATE TABLE SECCIONES ( 
SEC_COD VARCHAR(3) NOT NULL,
SEC_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_SECCIONES PRIMARY KEY CLUSTERED (SEC_COD),
 CONSTRAINT CK__SECCIONES__SEC_C__3CF40B7E CHECK ((len([SEC_COD]) > 0)),
 CONSTRAINT CK__SECCIONES__SEC_D__3DE82FB7 CHECK ((len([SEC_DES]) > 0)))
CREATE TABLE SUBGRUPOS ( 
SUB_COD VARCHAR(3) NOT NULL,
SUB_DES VARCHAR(30) NOT NULL,
SUB_GRU VARCHAR(3) NOT NULL,
SUB_INV VARCHAR(16),
SUB_COS VARCHAR(16),
SUB_VEN VARCHAR(16),
SUB_IVA VARCHAR(16),
SUB_RET VARCHAR(16),
SUB_IVC VARCHAR(16),
SUB_RFC VARCHAR(16),
SUB_DVV VARCHAR(16),
SUB_DIV VARCHAR(16),
SUB_DIC VARCHAR(16),
SUB_ARD VARCHAR(16),
SUB_ARC VARCHAR(16),
SUB_AUT VARCHAR(3),
SUB_PRF VARCHAR(3),
SUB_PRI VARCHAR(3),
SUB_ICA VARCHAR(16),
SUB_ICC VARCHAR(16),
SUB_CCC VARCHAR(16),
SUB_CCV VARCHAR(16),
SUB_CCD VARCHAR(16),
SUB_DDI BIT DEFAULT (0),
SUB_IMV VARCHAR(3),
SUB_CIC VARCHAR(16),
SUB_CID VARCHAR(16),
SUB_CIV VARCHAR(16),
SUB_CIN VARCHAR(16),
SUB_CIP VARCHAR(16),
SUB_IOC VARCHAR(16),
SUB_IOD VARCHAR(16),
SUB_IOV VARCHAR(16),
SUB_IOE VARCHAR(16),
SUB_AID VARCHAR(16),
SUB_AIC VARCHAR(16),
SUB_SOC VARCHAR(16),
SUB_SCD VARCHAR(16),
SUB_ICO VARCHAR(3),
SUB_VCD VARCHAR(16),
SUB_VCE VARCHAR(16)
 CONSTRAINT PK_SUBGRUPOS PRIMARY KEY CLUSTERED (SUB_COD),
 CONSTRAINT CK__SUBGRUPOS__SUB_C__40C49C62 CHECK ((len([SUB_COD]) > 0)),
 CONSTRAINT CK__SUBGRUPOS__SUB_D__41B8C09B CHECK ((len([SUB_DES]) > 0)),
 CONSTRAINT CK__SUBGRUPOS__SUB_G__42ACE4D4 CHECK ((len([SUB_GRU]) > 0)))
CREATE TABLE SUBZONAS ( 
SBZ_COD VARCHAR(3) NOT NULL,
SBZ_DES VARCHAR(30) NOT NULL,
SBZ_ZON VARCHAR(3) NOT NULL,
SBZ_FLE MONEY DEFAULT (0)
 CONSTRAINT PK_SUBZONAS PRIMARY KEY CLUSTERED (SBZ_COD),
 CONSTRAINT CK__SUBZONAS__SBZ_CO__4589517F CHECK ((len([SBZ_COD]) > 0)),
 CONSTRAINT CK__SUBZONAS__SBZ_DE__467D75B8 CHECK ((len([SBZ_DES]) > 0)),
 CONSTRAINT CK__SUBZONAS__SBZ_ZO__477199F1 CHECK ((len([SBZ_ZON]) > 0)))
CREATE TABLE SURTIDORES ( 
SUR_COD VARCHAR(3) NOT NULL,
SUR_TAN VARCHAR(3),
SUR_INI DECIMAL(17,4) DEFAULT (0),
SUR_LIS VARCHAR(1),
SUR_MNG VARCHAR(10),
SUR_MAX DECIMAL(14,4) DEFAULT (0)
 CONSTRAINT PK_SURTIDORES PRIMARY KEY CLUSTERED (SUR_COD),
 CONSTRAINT CK_SURTIDORESSUR_COD CHECK ((len([SUR_COD]) > 0)))
CREATE TABLE TABFLETE ( 
TAR_ORI VARCHAR(8) NOT NULL,
TAR_DES VARCHAR(8) NOT NULL,
TAR_UNI VARCHAR(3) NOT NULL,
TAR_COS MONEY DEFAULT (0),
TAR_VAL MONEY DEFAULT (0),
TAR_PAG MONEY DEFAULT (0)
 CONSTRAINT PK_TABFLETE PRIMARY KEY CLUSTERED (TAR_ORI,TAR_DES,TAR_UNI),
 CONSTRAINT CK__TABFLETE__TAR_DE__5006DFF2 CHECK ((len([TAR_DES]) > 0)),
 CONSTRAINT CK__TABFLETE__TAR_OR__4F12BBB9 CHECK ((len([TAR_ORI]) > 0)),
 CONSTRAINT CK__TABFLETE__TAR_UN__50FB042B CHECK ((len([TAR_UNI]) > 0)))
CREATE TABLE TABLADEAFORO ( 
AFO_TAN VARCHAR(3) NOT NULL,
AFO_CON INT DEFAULT (0) NOT NULL,
AFO_VAL DECIMAL(14,4) DEFAULT (0)
 CONSTRAINT PK_TABLADEAFORO PRIMARY KEY CLUSTERED (AFO_TAN,AFO_CON),
 CONSTRAINT CK__TABLADEAF__AFO_T__56B3DD81 CHECK ((len([AFO_TAN]) > 0)))
CREATE TABLE TABLAFRML ( 
AFO_TAN VARCHAR(3) NOT NULL,
AFO_CON INT DEFAULT (0) NOT NULL,
AFO_FRA DECIMAL(14,4) DEFAULT (0),
AFO_MIL DECIMAL(14,4) DEFAULT (0)
 CONSTRAINT PK_TABLAFRML PRIMARY KEY CLUSTERED (AFO_TAN,AFO_CON),
 CONSTRAINT CK__TABLAFRML__AFO_T__5B78929E CHECK ((len([AFO_TAN]) > 0)))
CREATE TABLE TABLAPOR ( 
POR_COD VARCHAR(3) NOT NULL,
POR_DES VARCHAR(20),
POR_CLA VARCHAR(3) NOT NULL,
POR_VAL DECIMAL(10,4) DEFAULT (0),
POR_MIN MONEY DEFAULT (0),
POR_MAX MONEY DEFAULT (0)
 CONSTRAINT PK_TABLAPOR PRIMARY KEY CLUSTERED (POR_COD),
 CONSTRAINT CK__TABLAPOR__POR_CL__6225902D CHECK ((len([POR_CLA]) > 0)),
 CONSTRAINT CK__TABLAPOR__POR_CO__61316BF4 CHECK ((len([POR_COD]) > 0)))
CREATE TABLE TANQUES ( 
TAN_NUM VARCHAR(3) NOT NULL,
TAN_CAP DECIMAL(14,4) DEFAULT (0),
TAN_PRO VARCHAR(16) NOT NULL,
TAN_SAL DECIMAL(14,4) DEFAULT (0),
TAN_UNI BIT DEFAULT (0) NOT NULL,
TAN_NNT VARCHAR(3),
TAN_HIB BIT DEFAULT (0) NOT NULL,
TAN_INV BIT DEFAULT (0) NOT NULL
 CONSTRAINT PK_TANQUES PRIMARY KEY CLUSTERED (TAN_NUM),
 CONSTRAINT CK__TANQUES__TAN_NUM__67DE6983 CHECK ((len([TAN_NUM]) > 0)),
 CONSTRAINT CK__TANQUES__TAN_PRO__69C6B1F5 CHECK ((len([TAN_PRO]) > 0)))
CREATE TABLE TARIFAS ( 
TAR_NUM INT DEFAULT ((0)) NOT NULL,
TAR_ORI VARCHAR(8) NOT NULL,
TAR_DES VARCHAR(8) NOT NULL,
TAR_UNI VARCHAR(3) NOT NULL,
TAR_TVH VARCHAR(3) NOT NULL,
TAR_RAN VARCHAR(3) NOT NULL,
TAR_NIT VARCHAR(11) NOT NULL,
TAR_TIP VARCHAR(3) NOT NULL,
TAR_COS MONEY DEFAULT ((0)),
TAR_VAL MONEY DEFAULT ((0)),
TAR_PAG MONEY DEFAULT ((0)),
TAR_DOL BIT DEFAULT ((0)) NOT NULL,
TAR_RUT VARCHAR(3),
TAR_VJE INT DEFAULT ((0)) NOT NULL
 CONSTRAINT PK_TARIFAS PRIMARY KEY CLUSTERED (TAR_NUM),
 CONSTRAINT CK__TARIFAS__TAR_DES__7167D3BD CHECK ((len([TAR_DES])>(0))),
 CONSTRAINT CK__TARIFAS__TAR_NIT__725BF7F6 CHECK ((len([TAR_NIT])>(0))),
 CONSTRAINT CK__TARIFAS__TAR_ORI__7073AF84 CHECK ((len([TAR_ORI])>(0))),
 CONSTRAINT CK__TARIFAS__TAR_TIP__73501C2F CHECK ((len([TAR_TIP])>(0))),
 CONSTRAINT CK__TARIFAS__TAR_TVH__74444068 CHECK ((len([TAR_TVH])>(0))))
CREATE TABLE TARIFASFLETES ( 
TAR_NUM INT DEFAULT ((0)) NOT NULL,
TAR_ORI VARCHAR(8) NOT NULL,
TAR_DES VARCHAR(8) NOT NULL,
TAR_UNI VARCHAR(3) NOT NULL,
TAR_TVH VARCHAR(3) NOT NULL,
TAR_RAN VARCHAR(3) NOT NULL,
TAR_COS MONEY DEFAULT ((0)) NOT NULL,
TAR_VAL MONEY DEFAULT ((0)) NOT NULL,
TAR_PAG MONEY DEFAULT ((0)) NOT NULL,
TAR_RUT VARCHAR(3),
TAR_VJE INT DEFAULT ((0)) NOT NULL
 CONSTRAINT PK_TARIFASFLETES PRIMARY KEY CLUSTERED (TAR_NUM),
 CONSTRAINT CK_TARIFASFLETESTAR_DES CHECK ((len([TAR_DES])>(0))),
 CONSTRAINT CK_TARIFASFLETESTAR_ORI CHECK ((len([TAR_ORI])>(0))),
 CONSTRAINT CK_TARIFASFLETESTAR_RAN CHECK ((len([TAR_RAN])>(0))),
 CONSTRAINT CK_TARIFASFLETESTAR_TVH CHECK ((len([TAR_TVH])>(0))),
 CONSTRAINT CK_TARIFASFLETESTAR_UNI CHECK ((len([TAR_UNI])>(0))))
CREATE TABLE TARPEAJES ( 
TAR_TIP VARCHAR(20) NOT NULL,
TAR_CAT VARCHAR(3) NOT NULL,
TAR_VAL MONEY DEFAULT (0) NOT NULL,
TAR_NIT VARCHAR(16)
 CONSTRAINT PK_TARPEAJES PRIMARY KEY CLUSTERED (TAR_TIP,TAR_CAT),
 CONSTRAINT CK__TARPEAJES__TAR_C__7BE56230 CHECK ((len([TAR_CAT]) > 0)),
 CONSTRAINT CK__TARPEAJES__TAR_T__7AF13DF7 CHECK ((len([TAR_TIP]) > 0)))
CREATE TABLE TASAS ( 
TAS_FEC SMALLDATETIME NOT NULL,
TAS_VAL MONEY DEFAULT (0)
 CONSTRAINT PK_TASAS PRIMARY KEY CLUSTERED (TAS_FEC))
CREATE TABLE TIPOS_DOC ( 
TIP_COD VARCHAR(3) NOT NULL,
TIP_DES VARCHAR(40) NOT NULL,
TIP_RES VARCHAR(20),
TIP_FEC SMALLDATETIME,
TIP_NUM VARCHAR(30) DEFAULT ('0-0'),
TIP_PRE VARCHAR(5),
TIP_AUT BIT DEFAULT (0) NOT NULL,
TIP_MEN VARCHAR(250),
TIP_LOT BIT DEFAULT (0) NOT NULL,
TIP_FOR VARCHAR(20),
TIP_SEP VARCHAR(5) DEFAULT ('1001'),
TIP_FAB VARCHAR(5)
 CONSTRAINT PK_TIPOS_DOC PRIMARY KEY CLUSTERED (TIP_COD),
 CONSTRAINT CK__TIPOS_DOC__TIP_C__02925FBF CHECK ((len([TIP_COD]) > 0)),
 CONSTRAINT CK__TIPOS_DOC__TIP_D__038683F8 CHECK ((len([TIP_DES]) > 0)))
CREATE TABLE TIPOSCAR ( 
CAR_COD VARCHAR(3) NOT NULL,
CAR_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_TIPOSCAR PRIMARY KEY CLUSTERED (CAR_COD),
 CONSTRAINT CK__TIPOSCAR__CAR_CO__0A338187 CHECK ((len([CAR_COD]) > 0)),
 CONSTRAINT CK__TIPOSCAR__CAR_DE__0B27A5C0 CHECK ((len([CAR_DES]) > 0)))
CREATE TABLE TIPOSCOM ( 
COM_COD VARCHAR(3) NOT NULL,
COM_DES VARCHAR(30) NOT NULL,
COM_VAL MONEY DEFAULT (0) NOT NULL
 CONSTRAINT PK_TIPOSCOM PRIMARY KEY CLUSTERED (COM_COD),
 CONSTRAINT CK__TIPOSCOM__COM_CO__0E04126B CHECK ((len([COM_COD]) > 0)),
 CONSTRAINT CK__TIPOSCOM__COM_DE__0EF836A4 CHECK ((len([COM_DES]) > 0)))
CREATE TABLE TIPOSCOMNIIF ( 
TIP_COD VARCHAR(3) NOT NULL,
TIP_CIA CHAR(2) NOT NULL,
TIP_CLA VARCHAR(10) NOT NULL,
TIP_TCN VARCHAR(3) NOT NULL
 CONSTRAINT PK_TIPOSCOMNIIF PRIMARY KEY CLUSTERED (TIP_COD,TIP_CIA,TIP_CLA),
 CONSTRAINT CK_TIPOSCOMNIIFTIP_CIA CHECK ((len([TIP_CIA])>(0))),
 CONSTRAINT CK_TIPOSCOMNIIFTIP_CLA CHECK ((len([TIP_CLA])>(0))),
 CONSTRAINT CK_TIPOSCOMNIIFTIP_COD CHECK ((len([TIP_COD])>(0))),
 CONSTRAINT CK_TIPOSCOMNIIFTIP_TCN CHECK ((len([TIP_TCN])>(0))))
CREATE TABLE TIPOSCOMP ( 
TIP_COD VARCHAR(3) NOT NULL,
TIP_DES VARCHAR(40),
TIP_DIA VARCHAR(3),
TIP_AUT BIT DEFAULT (0) NOT NULL,
TIP_EGR BIT DEFAULT (0) NOT NULL,
TIP_FOR VARCHAR(20),
TIP_SEP VARCHAR(5) DEFAULT ('1001'),
TIP_FEC CHAR(1),
TIP_CLA VARCHAR(10),
TIP_SOP BIT DEFAULT ((0))
 CONSTRAINT PK_TIPOSCOMP PRIMARY KEY CLUSTERED (TIP_COD),
 CONSTRAINT CK__TIPOSCOMP__TIP_C__12C8C788 CHECK ((len([TIP_COD]) > 0)))
CREATE TABLE TIPOSCOMRES ( 
RES_COD VARCHAR(3) NOT NULL,
RES_DES VARCHAR(50) NOT NULL,
RES_PRE VARCHAR(5),
RES_INI INT DEFAULT ((0)) NOT NULL,
RES_FIN INT DEFAULT ((0)) NOT NULL,
RES_FEC SMALLDATETIME NOT NULL,
RES_FVC SMALLDATETIME,
RES_EST VARCHAR(100)
 CONSTRAINT PK_TIPOSCOMRES PRIMARY KEY CLUSTERED (RES_COD),
 CONSTRAINT CK_TIPOSCOMRESRES_COD CHECK ((len([RES_COD])>(0))),
 CONSTRAINT CK_TIPOSCOMRESRES_DES CHECK ((len([RES_DES])>(0))))
CREATE TABLE TIPOSCON ( 
TIP_COD VARCHAR(3) NOT NULL,
TIP_DES VARCHAR(50) NOT NULL
 CONSTRAINT PK_TIPOSCON PRIMARY KEY CLUSTERED (TIP_COD),
 CONSTRAINT CK_TIPOSCONTIP_COD CHECK ((len([TIP_COD]) > 0)),
 CONSTRAINT CK_TIPOSCONTIP_DES CHECK ((len([TIP_DES]) > 0)))
CREATE TABLE TIPOSESC ( 
TIP_COD VARCHAR(3) NOT NULL,
TIP_DES VARCHAR(50) NOT NULL
 CONSTRAINT PK_TIPOSESC PRIMARY KEY CLUSTERED (TIP_COD),
 CONSTRAINT CK_TIPOSESCTIP_COD CHECK ((len([TIP_COD]) > 0)),
 CONSTRAINT CK_TIPOSESCTIP_DES CHECK ((len([TIP_DES]) > 0)))
CREATE TABLE TIPOSFAC ( 
TFA_COD VARCHAR(3) NOT NULL,
TFA_DES VARCHAR(50) NOT NULL,
TFA_DOC VARCHAR(3) NOT NULL
 CONSTRAINT PK_TIPOSFAC PRIMARY KEY CLUSTERED (TFA_COD),
 CONSTRAINT CK_TIPOSFACTFA_COD CHECK ((len([TFA_COD])>(0))),
 CONSTRAINT CK_TIPOSFACTFA_DES CHECK ((len([TFA_DES])>(0))),
 CONSTRAINT CK_TIPOSFACTFA_DOC CHECK ((len([TFA_DOC])>(0))))
CREATE TABLE TIPOSMOT ( 
MOT_COD VARCHAR(3) NOT NULL,
MOT_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_TIPOSMOT PRIMARY KEY CLUSTERED (MOT_COD),
 CONSTRAINT CK__TIPOSMOT__MOT_CO__1881A0DE CHECK ((len([MOT_COD]) > 0)),
 CONSTRAINT CK__TIPOSMOT__MOT_DE__1975C517 CHECK ((len([MOT_DES]) > 0)))
CREATE TABLE TIPOSNAV ( 
TIP_COD VARCHAR(3) NOT NULL,
TIP_DES VARCHAR(50) NOT NULL
 CONSTRAINT PK_TIPOSNAV PRIMARY KEY CLUSTERED (TIP_COD),
 CONSTRAINT CK_TIPOSNAVTIP_COD CHECK ((len([TIP_COD]) > 0)),
 CONSTRAINT CK_TIPOSNAVTIP_DES CHECK ((len([TIP_DES]) > 0)))
CREATE TABLE TIPOSPAGO ( 
TIP_COD VARCHAR(3) NOT NULL,
TIP_DES VARCHAR(30) NOT NULL,
TIP_ORD SMALLINT DEFAULT (99),
TIP_CAJ BIT DEFAULT (0) NOT NULL,
TIP_REF BIT DEFAULT (0) NOT NULL,
TIP_VAL BIT DEFAULT ((0)),
TIP_VCO BIT DEFAULT ((0)),
TIP_COM VARCHAR(20),
TIP_PRO BIT DEFAULT ((0)),
TIP_TKT BIT DEFAULT ((0))
 CONSTRAINT PK_TIPOSPAGO PRIMARY KEY CLUSTERED (TIP_COD),
 CONSTRAINT CK__TIPOSPAGO__TIP_C__1C5231C2 CHECK ((len([TIP_COD]) > 0)),
 CONSTRAINT CK__TIPOSPAGO__TIP_D__1D4655FB CHECK ((len([TIP_DES]) > 0)))
CREATE TABLE TIPOSRF ( 
TIP_COD VARCHAR(10) NOT NULL,
TIP_DES VARCHAR(250) NOT NULL
 CONSTRAINT PK_TIPOSRF PRIMARY KEY CLUSTERED (TIP_COD),
 CONSTRAINT CK_TIPOSRFTIP_COD CHECK ((len([TIP_COD])>(0))),
 CONSTRAINT CK_TIPOSRFTIP_DES CHECK ((len([TIP_DES])>(0))))
CREATE TABLE TIPOSTEN ( 
TEN_COD VARCHAR(3) NOT NULL,
TEN_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_TIPOSTEN PRIMARY KEY CLUSTERED (TEN_COD),
 CONSTRAINT CK__TIPOSTEN__TEN_CO__22FF2F51 CHECK ((len([TEN_COD]) > 0)),
 CONSTRAINT CK__TIPOSTEN__TEN_DE__23F3538A CHECK ((len([TEN_DES]) > 0)))
CREATE TABLE TIPOSVEH ( 
TIP_COD VARCHAR(3) NOT NULL,
TIP_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_TIPOSVEH PRIMARY KEY CLUSTERED (TIP_COD),
 CONSTRAINT CK__TIPOSVEH__TIP_CO__26CFC035 CHECK ((len([TIP_COD]) > 0)),
 CONSTRAINT CK__TIPOSVEH__TIP_DE__27C3E46E CHECK ((len([TIP_DES]) > 0)))
CREATE TABLE TRAYLER ( 
TRA_NUM VARCHAR(10) NOT NULL,
TRA_MAR VARCHAR(4),
TRA_COL VARCHAR(5),
TRA_MOD VARCHAR(4) NOT NULL,
TRA_CAR VARCHAR(3),
TRA_EJE VARCHAR(6),
TRA_ANC DECIMAL(10,4) DEFAULT (0),
TRA_ALT DECIMAL(10,4) DEFAULT (0),
TRA_LAR DECIMAL(10,4) DEFAULT (0),
TRA_VOL DECIMAL(10,4) DEFAULT (0),
TRA_CHA VARCHAR(25),
TRA_CAP VARCHAR(20),
TRA_PES VARCHAR(20),
TRA_TRA VARCHAR(30),
TRA_PRO VARCHAR(11) NOT NULL,
TRA_FEC SMALLDATETIME
 CONSTRAINT PK_TRAYLER PRIMARY KEY CLUSTERED (TRA_NUM),
 CONSTRAINT CK__TRAYLER__TRA_COL__2C88998B CHECK ((len([TRA_COL]) > 0)),
 CONSTRAINT CK__TRAYLER__TRA_MAR__2B947552 CHECK ((len([TRA_MAR]) > 0)),
 CONSTRAINT CK__TRAYLER__TRA_MOD__2D7CBDC4 CHECK ((len([TRA_MOD]) > 0)),
 CONSTRAINT CK__TRAYLER__TRA_NUM__2AA05119 CHECK ((len([TRA_NUM]) > 0)),
 CONSTRAINT CK__TRAYLER__TRA_PRO__324172E1 CHECK ((len([TRA_PRO]) > 0)))
CREATE TABLE TURNOS ( 
TUR_COD VARCHAR(3) NOT NULL,
TUR_DES VARCHAR(30) NOT NULL,
TUR_INI VARCHAR(10),
TUR_FIN VARCHAR(10)
 CONSTRAINT PK_TURNOS PRIMARY KEY CLUSTERED (TUR_COD),
 CONSTRAINT CK__TURNOS__TUR_COD__351DDF8C CHECK ((len([TUR_COD]) > 0)),
 CONSTRAINT CK__TURNOS__TUR_DES__361203C5 CHECK ((len([TUR_DES]) > 0)))
CREATE TABLE UNIDADES ( 
UNI_COD VARCHAR(3) NOT NULL,
UNI_DES VARCHAR(30) NOT NULL,
UNI_CFE VARCHAR(20)
 CONSTRAINT PK_UNIDADES PRIMARY KEY CLUSTERED (UNI_COD),
 CONSTRAINT CK__UNIDADES__UNI_CO__38EE7070 CHECK ((len([UNI_COD]) > 0)),
 CONSTRAINT CK__UNIDADES__UNI_DE__39E294A9 CHECK ((len([UNI_DES]) > 0)))
CREATE TABLE VEHCLIENTE ( 
VHC_VEH VARCHAR(10) NOT NULL,
VHC_NIT VARCHAR(11) NOT NULL
 CONSTRAINT PK_VEHCLIENTE PRIMARY KEY CLUSTERED (VHC_VEH,VHC_NIT),
 CONSTRAINT CK__VEHCLIENT__VHC_N__3DB3258D CHECK ((len([VHC_NIT]) > 0)),
 CONSTRAINT CK__VEHCLIENT__VHC_V__3CBF0154 CHECK ((len([VHC_VEH]) > 0)))
CREATE TABLE VEHICULOS ( 
VEH_PLA VARCHAR(10) NOT NULL,
VEH_MAR VARCHAR(4),
VEH_LIN VARCHAR(7) NOT NULL,
VEH_COL VARCHAR(5),
VEH_TIP VARCHAR(3) NOT NULL,
VEH_MOD VARCHAR(4),
VEH_REP VARCHAR(4),
VEH_CAP VARCHAR(10),
VEH_PES VARCHAR(10),
VEH_EJE VARCHAR(6) NOT NULL,
VEH_CHA VARCHAR(25),
VEH_MOT VARCHAR(25),
VEH_TRA VARCHAR(10),
VEH_CAR VARCHAR(3),
VEH_MAT VARCHAR(4),
VEH_COT VARCHAR(5),
VEH_EMP VARCHAR(11),
VEH_PRO VARCHAR(11) NOT NULL,
VEH_POS VARCHAR(11) NOT NULL,
VEH_CON VARCHAR(11),
VEH_NSO VARCHAR(20),
VEH_VSO SMALLDATETIME,
VEH_ESO VARCHAR(11),
VEH_REG VARCHAR(20),
VEH_VRE SMALLDATETIME,
VEH_TAR VARCHAR(20),
VEH_VPR BIT DEFAULT (0) NOT NULL,
VEH_CIV VARCHAR(20),
VEH_VCI SMALLDATETIME,
VEH_FPP SMALLDATETIME,
VEH_FUP SMALLDATETIME,
VEH_VAL MONEY DEFAULT (0),
VEH_ASE MONEY DEFAULT (0),
VEH_NTO VARCHAR(20),
VEH_VTO SMALLDATETIME,
VEH_BLO BIT DEFAULT (0) NOT NULL,
VEH_TEN VARCHAR(3),
VEH_FOT VARCHAR(20),
VEH_FEC SMALLDATETIME,
VEH_LTR VARCHAR(20),
VEH_FLT SMALLDATETIME,
VEH_AND VARCHAR(20),
VEH_FAN SMALLDATETIME,
VEH_TMO VARCHAR(3),
VEH_CAT VARCHAR(3),
VEH_RNC VARCHAR(20),
VEH_VRC SMALLDATETIME,
VEH_HID VARCHAR(20),
VEH_VHI SMALLDATETIME,
VEH_GAS VARCHAR(20),
VEH_VCG SMALLDATETIME,
VEH_BOM VARCHAR(20),
VEH_VBO SMALLDATETIME,
VEH_RTM VARCHAR(20),
VEH_VRT SMALLDATETIME,
VEH_OBS VARCHAR(250),
VEH_AFI BIT DEFAULT (0),
VEH_OGT VARCHAR(4),
VEH_NDI VARCHAR(50),
VEH_FIS VARCHAR(4),
VEH_COM VARCHAR(3),
VEH_GPS VARCHAR(250),
VEH_GPU VARCHAR(50),
VEH_GPC VARCHAR(50),
VEH_GPN VARCHAR(11)
 CONSTRAINT PK_VEHICULOS PRIMARY KEY CLUSTERED (VEH_PLA),
 CONSTRAINT CK_VEHICULOSVEH_COL CHECK ((len([VEH_COL]) > 0)),
 CONSTRAINT CK_VEHICULOSVEH_EJE CHECK ((len([VEH_EJE]) > 0)),
 CONSTRAINT CK_VEHICULOSVEH_LIN CHECK ((len([VEH_LIN]) > 0)),
 CONSTRAINT CK_VEHICULOSVEH_MAR CHECK ((len([VEH_MAR]) > 0)),
 CONSTRAINT CK_VEHICULOSVEH_PLA CHECK ((len([VEH_PLA]) > 0)),
 CONSTRAINT CK_VEHICULOSVEH_POS CHECK ((len([VEH_POS]) > 0)),
 CONSTRAINT CK_VEHICULOSVEH_PRO CHECK ((len([VEH_PRO]) > 0)),
 CONSTRAINT CK_VEHICULOSVEH_TIP CHECK ((len([VEH_TIP]) > 0)))
CREATE TABLE VEHMAY ( 
VEH_PLA VARCHAR(10) NOT NULL,
VEH_DES VARCHAR(30),
VEH_TRA VARCHAR(10),
VEH_CAP INT DEFAULT (0) NOT NULL,
VEH_CON VARCHAR(11) NOT NULL,
VEH_EMP VARCHAR(11),
VEH_COM SMALLINT DEFAULT (1) NOT NULL,
VEH_CM1 INT DEFAULT (0),
VEH_CM2 INT DEFAULT (0),
VEH_CM3 INT DEFAULT (0),
VEH_CM4 INT DEFAULT (0),
VEH_CM5 INT DEFAULT (0),
VEH_BLO BIT DEFAULT (0) NOT NULL
 CONSTRAINT PK_VEHMAY PRIMARY KEY CLUSTERED (VEH_PLA),
 CONSTRAINT CK__VEHMAY__VEH_CON__4FD1D5C8 CHECK ((len([VEH_CON]) > 0)),
 CONSTRAINT CK__VEHMAY__VEH_PLA__4DE98D56 CHECK ((len([VEH_PLA]) > 0)))
CREATE TABLE ZONAS ( 
ZON_COD VARCHAR(3) NOT NULL,
ZON_DES VARCHAR(30) NOT NULL
 CONSTRAINT PK_ZONAS PRIMARY KEY CLUSTERED (ZON_COD),
 CONSTRAINT CK__ZONAS__ZON_COD__595B4002 CHECK ((len([ZON_COD]) > 0)),
 CONSTRAINT CK__ZONAS__ZON_DES__5A4F643B CHECK ((len([ZON_DES]) > 0)))
GO
 CREATE UNIQUE CLUSTERED INDEX IX_ProdEstandaresCodigo ON PRODESTANDARES(Codigo)

GO
 CREATE NONCLUSTERED INDEX IX_REFERENCIASREF_LIN ON REFERENCIAS(REF_LIN)
 CREATE NONCLUSTERED INDEX IX_REFERENCIASREF_GRU ON REFERENCIAS(REF_GRU)
 CREATE NONCLUSTERED INDEX IX_REFERENCIASREF_SUB ON REFERENCIAS(REF_SUB)

GO
