1
I have several tables with the same structure, but with different names.
Ex.:
CREATE TABLE `log_historico_25072016` (
`lhis_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`lhis_cvei_id` INT(10) UNSIGNED NOT NULL,
`lhis_sequencia` SMALLINT(5) UNSIGNED NOT NULL,
`lhis_tapl_id` TINYINT(3) UNSIGNED NOT NULL,
`lhis_cevt_id` SMALLINT(5) UNSIGNED NOT NULL,
`lhis_data_gps` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
`lhis_data_ins` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`lhis_latitude` FLOAT NOT NULL,
`lhis_longitude` FLOAT NOT NULL,
`lhis_cpnt_id` INT(10) UNSIGNED NOT NULL,
`lhis_ignicao` CHAR(1) NOT NULL,
`lhis_velocidade` TINYINT(3) UNSIGNED NOT NULL,
`lhis_nsat` TINYINT(3) UNSIGNED NOT NULL,
`lhis_curso` SMALLINT(5) UNSIGNED NOT NULL,
`lhis_info` SMALLINT(5) UNSIGNED NOT NULL,
`lhis_dop` TINYINT(3) UNSIGNED NOT NULL,
`lhis_input` BIGINT(20) NOT NULL,
`lhis_output` SMALLINT(5) UNSIGNED NOT NULL,
`lhis_tmco_id` TINYINT(3) UNSIGNED NOT NULL,
`lhis_inAlarme` CHAR(1) NOT NULL,
`lhis_chip` TINYINT(3) UNSIGNED NOT NULL,
`lhis_crua_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`lhis_ext_id` INT(10) UNSIGNED NULL DEFAULT NULL,
`lhis_altitude` TINYINT(4) NOT NULL DEFAULT '0',
`lhis_consumo` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`lhis_ltemp_1` TINYINT(3) UNSIGNED NULL DEFAULT NULL,
`lhis_ltemp_2` TINYINT(3) UNSIGNED NULL DEFAULT NULL,
`lhis_ltemp_3` TINYINT(3) UNSIGNED NULL DEFAULT NULL,
`lhis_ltemp_4` TINYINT(3) UNSIGNED NULL DEFAULT NULL,
PRIMARY KEY (`lhis_id`),
UNIQUE INDEX `lhis_cvei_gps_seq_apl_evt_un_27052016` (`lhis_cvei_id`, `lhis_data_gps`, `lhis_sequencia`, `lhis_tapl_id`, `lhis_cevt_id`),
INDEX `lhis_data_gps_ix` (`lhis_data_gps`),
INDEX `lhis_data_ins_ix` (`lhis_data_ins`)
CREATE TABLE `log_historico_26072016` (
`lhis_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`lhis_cvei_id` INT(10) UNSIGNED NOT NULL,
`lhis_sequencia` SMALLINT(5) UNSIGNED NOT NULL,
`lhis_tapl_id` TINYINT(3) UNSIGNED NOT NULL,
`lhis_cevt_id` SMALLINT(5) UNSIGNED NOT NULL,
`lhis_data_gps` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
`lhis_data_ins` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`lhis_latitude` FLOAT NOT NULL,
`lhis_longitude` FLOAT NOT NULL,
`lhis_cpnt_id` INT(10) UNSIGNED NOT NULL,
`lhis_ignicao` CHAR(1) NOT NULL,
`lhis_velocidade` TINYINT(3) UNSIGNED NOT NULL,
`lhis_nsat` TINYINT(3) UNSIGNED NOT NULL,
`lhis_curso` SMALLINT(5) UNSIGNED NOT NULL,
`lhis_info` SMALLINT(5) UNSIGNED NOT NULL,
`lhis_dop` TINYINT(3) UNSIGNED NOT NULL,
`lhis_input` BIGINT(20) NOT NULL,
`lhis_output` SMALLINT(5) UNSIGNED NOT NULL,
`lhis_tmco_id` TINYINT(3) UNSIGNED NOT NULL,
`lhis_inAlarme` CHAR(1) NOT NULL,
`lhis_chip` TINYINT(3) UNSIGNED NOT NULL,
`lhis_crua_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`lhis_ext_id` INT(10) UNSIGNED NULL DEFAULT NULL,
`lhis_altitude` TINYINT(4) NOT NULL DEFAULT '0',
`lhis_consumo` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
`lhis_ltemp_1` TINYINT(3) UNSIGNED NULL DEFAULT NULL,
`lhis_ltemp_2` TINYINT(3) UNSIGNED NULL DEFAULT NULL,
`lhis_ltemp_3` TINYINT(3) UNSIGNED NULL DEFAULT NULL,
`lhis_ltemp_4` TINYINT(3) UNSIGNED NULL DEFAULT NULL,
PRIMARY KEY (`lhis_id`),
UNIQUE INDEX `lhis_cvei_gps_seq_apl_evt_un_27052016` (`lhis_cvei_id`, `lhis_data_gps`, `lhis_sequencia`, `lhis_tapl_id`, `lhis_cevt_id`),
INDEX `lhis_data_gps_ix` (`lhis_data_gps`),
INDEX `lhis_data_ins_ix` (`lhis_data_ins`)
The table name is defined by log_historico_ddmmyyyy
You can use EF to map these tables?