CREATE PROCEDURE usp_populate_DiabloSpecTableMapping
AS
SET NOCOUNT ON ;
WITH DiabloSpecTableMapping
AS (SELECT [FlatFileName],
[TableName]
FROM ( VALUES ( 'bld.txt', 'Building'), ( 'bld.txt', 'FiBuilding'), ( 'bld.txt', 'LiBuilding'), ( 'bld_amenity_cd.txt', 'Building'),
( 'bld_amenity_cd.txt', 'BuildingAmenity'), ( 'bld_bld_cf_grp_info_01.txt', 'Building'),
( 'bld_bld_cf_grp_info_01.txt', 'BuildingFeature'), ( 'bld_bld_comment_txt.txt', 'Building'),
( 'bld_bld_permit_grp.txt', 'Building'), ( 'bld_bld_permit_grp.txt', 'BuildingPermit'), ( 'bld_bld_rf_grp_info_01.txt', 'Building'),
( 'bld_bld_rf_grp_info_01.txt', 'BuildingFeature'), ( 'bld_bld_use_grp.txt', 'Building'),
( 'bld_bld_xf_grp_info_01.txt', 'Building'), ( 'bld_bld_xf_grp_info_01.txt', 'BuildingExtraFeature'),
( 'bld_eqpmt_cd.txt', 'Building'), ( 'bld_eqpmt_cd.txt', 'BuildingEquipment'), ( 'bld_fi_bld_rf_grp_info.txt', 'Building'),
( 'bld_fi_bld_rf_grp_info.txt', 'FiBuildingFeature'), ( 'bld_fi_sq_ft_grp_info.txt', 'Building'),
( 'bld_fi_sq_ft_grp_info.txt', 'FiBuildingSquareFootageDetail'), ( 'bld_impr_yy_blt_grp_01.txt', 'Building'),
( 'bld_li_bld_comment_txt.txt', 'Building'), ( 'bld_li_bld_comment_txt.txt', 'LiBuilding'), ( 'bld_li_bld_xf_cd.txt', 'Building'),
( 'bld_li_bld_xf_cd.txt', 'LiBuildingExtraFeature'), ( 'bld_li_eqpmt_cd.txt', 'Building'),
( 'bld_li_eqpmt_cd.txt', 'LiBuildingEquipment'), ( 'bld_li_othr_rms_cd.txt', 'Building'),
( 'bld_li_othr_rms_cd.txt', 'LiBuildingOtherRoom'), ( 'bld_othr_impv_cd.txt', 'Building'),
( 'bld_othr_impv_cd.txt', 'BuildingOtherImprovement'), ( 'bld_othr_rms_cd.txt', 'Building'),
( 'bld_othr_rms_cd.txt', 'BuildingOtherRoom'), ( 'bld_othr_structure_grp.txt', 'Building'),
( 'bld_othr_structure_grp.txt', 'BuildingOtherStructure'), ( 'bld_pcl_info_for_bldg.txt', 'Building'),
( 'bld_sketch_txt.txt', 'Building'), ( 'bld_sq_ft_grp_info_01.txt', 'Building'),
( 'bld_sq_ft_grp_info_01.txt', 'BuildingSquareFootageDetail'), ( 'bld_subarea_grp_info.txt', 'Building'),
( 'bld_subarea_grp_info.txt', 'BuildingSubArea'), ( 'pcl.txt', 'FiProperty'), ( 'pcl.txt', 'LiProperty'), ( 'pcl.txt', 'Property'),
( 'pcl.txt', 'Property_Pre2'), ( 'pcl.txt', 'Property_Prev'), ( 'pcl.txt', 'PropertyLegalParty'),
( 'pcl.txt', 'PropertyLegalPartyName'), ( 'pcl.txt', 'PropertySitus'), ( 'pcl.txt', 'PropertyText'),
( 'pcl_aerial_map_grp_info_01.txt', 'Property'), ( 'pcl_appr_ot_lnduse_grp.txt', 'Property'), ( 'pcl_assd_impv_grp.txt', 'Property'),
( 'pcl_assd_lnd_grp.txt', 'Property'), ( 'pcl_assd_ot_lnduse_grp.txt', 'Property'), ( 'pcl_assd_pers_prop_grp.txt', 'Property'),
( 'pcl_asse_addr.txt', 'Property'), ( 'pcl_asse_addr.txt', 'PropertyLegalParty'), ( 'pcl_asse_co_nm.txt', 'Property'),
( 'pcl_asse_co_nm.txt', 'PropertyLegalPartyName'), ( 'pcl_asse_grp_info_01.txt', 'Property'),
( 'pcl_asse_grp_info_01.txt', 'PropertyLegalPartyParsed'), ( 'pcl_asse_nm_grp.txt', 'Property'),
( 'pcl_asse_nm_grp.txt', 'PropertyLegalPartyName'), ( 'pcl_asse_orig_addr.txt', 'Property'),
( 'pcl_asse_orig_addr.txt', 'PropertyLegalParty'), ( 'pcl_asse_orig_nm.txt', 'Property'),
( 'pcl_asse_orig_nm.txt', 'PropertyLegalPartyOrigName'), ( 'pcl_cnty_lgl_txt.txt', 'Property'),
( 'pcl_cnty_lgl_txt.txt', 'PropertyText'), ( 'pcl_comment_txt.txt', 'Property'), ( 'pcl_comment_txt.txt', 'PropertyText'),
( 'pcl_dist_tax_grp_info.txt', 'Property'), ( 'pcl_fi_lnddim_grp_info.txt', 'FiPropertyLandDimensionDetail'),
( 'pcl_fi_lnddim_grp_info.txt', 'Property'), ( 'pcl_fi_lot_info_grp.txt', 'FiPropertyLot'), ( 'pcl_fi_lot_info_grp.txt', 'Property'),
( 'pcl_fi_topography_cd.txt', 'FiProperty'), ( 'pcl_fi_topography_cd.txt', 'Property'), ( 'pcl_li_dist_cnty_cd.txt', 'LiProperty'),
( 'pcl_li_dist_cnty_cd.txt', 'Property'), ( 'pcl_li_pcl_comment_txt.txt', 'LiPropertyText'),
( 'pcl_li_pcl_comment_txt.txt', 'Property'), ( 'pcl_lnd_dim_grp_info.txt', 'Property'),
( 'pcl_lnd_dim_grp_info.txt', 'PropertyLandDimensionDetail'), ( 'pcl_lot_info_grp.txt', 'Property'),
( 'pcl_lot_info_grp.txt', 'PropertyLot'), ( 'pcl_map_atlas_grp_info.txt', 'Property'), ( 'pcl_misc_othr_val_grp.txt', 'Property'),
( 'pcl_mkt_impv_grp.txt', 'Property'), ( 'pcl_mkt_ot_lnduse_grp.txt', 'Property'), ( 'pcl_nghbrhd_type_cd.txt', 'Property'),
( 'pcl_ownr_addr.txt', 'Property'), ( 'pcl_ownr_addr.txt', 'PropertyLegalParty'), ( 'pcl_ownr_addr_dpv_note.txt', 'Property'),
( 'pcl_ownr_addr_dpv_note.txt', 'PropertyLegalParty'), ( 'pcl_ownr_co_nm.txt', 'Property'),
( 'pcl_ownr_co_nm.txt', 'PropertyLegalPartyName'), ( 'pcl_ownr_grp_info_01.txt', 'Property'),
( 'pcl_ownr_grp_info_01.txt', 'PropertyLegalPartyParsed'), ( 'pcl_ownr_grp_info_02.txt', 'Property'),
( 'pcl_ownr_grp_info_02.txt', 'PropertyLegalPartyName'), ( 'pcl_ownr_nm_grp.txt', 'Property'),
( 'pcl_ownr_nm_grp.txt', 'PropertyLegalPartyName'), ( 'pcl_ownr_orig_addr.txt', 'Property'),
( 'pcl_ownr_orig_addr.txt', 'PropertyLegalParty'), ( 'pcl_ownr_orig_nm.txt', 'Property'),
( 'pcl_ownr_orig_nm.txt', 'PropertyLegalPartyOrigName'), ( 'pcl_pcl_comment_txt.txt', 'Property'),
( 'pcl_pcl_comment_txt.txt', 'PropertyText'), ( 'pcl_pcl_oby_grp_info_01.txt', 'Property'),
( 'pcl_pcl_oby_grp_info_01.txt', 'PropertyResidentialFeature'), ( 'pcl_pcl_sit_grp_info_01.txt', 'Property'),
( 'pcl_pcl_sit_grp_info_01.txt', 'PropertySitus'), ( 'pcl_pcl_special_grp.txt', 'Property'),
( 'pcl_pcl_xf_grp_info_01.txt', 'Property'), ( 'pcl_sch_metrics.txt', 'Property'), ( 'pcl_sch_metrics.txt', 'PropertySchoolMetrics'),
( 'pcl_sit_dpv_note.txt', 'Property'), ( 'pcl_sit_dpv_note.txt', 'PropertySitus'), ( 'pcl_tax_amt_grp.txt', 'Property'),
( 'pcl_tax_amt_grp.txt', 'PropertyOtherTaxDetail'), ( 'pcl_tax_exmp_grp_info_01.txt', 'Property'),
( 'pcl_tax_exmp_grp_info_01.txt', 'PropertyTaxExemption'), ( 'pcl_taxgrid_grp.txt', 'Property'),
( 'pcl_taxgrid_grp.txt', 'PropertyTaxGridDetail'), ( 'pcl_topography_cd.txt', 'Property'), ( 'pcl_trw_map_grp_info.txt', 'Property'),
( 'pcl_txpr_addr.txt', 'Property'), ( 'pcl_txpr_addr.txt', 'PropertyLegalParty'), ( 'pcl_txpr_co_nm.txt', 'Property'),
( 'pcl_txpr_co_nm.txt', 'PropertyLegalPartyName'), ( 'pcl_txpr_grp_info_01.txt', 'Property'),
( 'pcl_txpr_grp_info_01.txt', 'PropertyLegalPartyParsed'), ( 'pcl_txpr_nm_grp.txt', 'Property'),
( 'pcl_txpr_nm_grp.txt', 'PropertyLegalPartyName'), ( 'pcl_txpr_orig_addr.txt', 'Property'),
( 'pcl_txpr_orig_addr.txt', 'PropertyLegalParty'), ( 'pcl_txpr_orig_nm.txt', 'Property'),
( 'pcl_txpr_orig_nm.txt', 'PropertyLegalPartyOrigName'), ( 'pcl_unv_tax_exmp_grp_1.txt', 'Property'),
( 'pcl_water_info_grp.txt', 'Property'), ( 'trans.txt', 'Trans'), ( 'trans.txt', 'TransAssignment'), ( 'trans.txt', 'TransDeed'),
( 'trans.txt', 'TransInvoluntaryLien'), ( 'trans.txt', 'TransLegal'), ( 'trans.txt', 'TransLegalParty'),
( 'trans.txt', 'TransLegalPartyName'), ( 'trans.txt', 'TransLegalPartyParsed'), ( 'trans.txt', 'TransLien'),
( 'trans.txt', 'TransPcrFields'), ( 'trans.txt', 'TransPreForeclosure'), ( 'trans.txt', 'TransRelease'),
( 'trans.txt', 'TransSitus'), ( 'trans.txt', 'TransText'), ( 'trans.txt', 'UniversalProperty'),
( 'trans_t_bld_comment_txt.txt', 'Trans'), ( 'trans_t_bld_comment_txt.txt', 'TransText'), ( 'trans_t_buy_addr.txt', 'Trans'),
( 'trans_t_buy_addr.txt', 'TransLegalParty'), ( 'trans_t_buy_addr_dpvnote.txt', 'Trans'),
( 'trans_t_buy_addr_dpvnote.txt', 'TransLegalParty'), ( 'trans_t_buy_cd_tabl_grp.txt', 'Trans'),
( 'trans_t_buy_cd_tabl_grp.txt', 'TransLegalPartyName'), ( 'trans_t_buy_co_nm.txt', 'Trans'),
( 'trans_t_buy_co_nm.txt', 'TransLegalPartyName'), ( 'trans_t_buy_grp_info_01.txt', 'Trans'),
( 'trans_t_buy_grp_info_01.txt', 'TransLegalPartyParsed'), ( 'trans_t_buy_nm_grp.txt', 'Trans'),
( 'trans_t_buy_nm_grp.txt', 'TransLegalParty'), ( 'trans_t_buy_nm_grp.txt', 'TransLegalPartyName'),
( 'trans_t_buy_orig_addr.txt', 'Trans'), ( 'trans_t_buy_orig_addr.txt', 'TransLegalParty'), ( 'trans_t_buy_orig_nm.txt', 'Trans'),
( 'trans_t_buy_orig_nm.txt', 'TransLegalPartyOrigName'), ( 'trans_t_comment_txt.txt', 'Trans'),
( 'trans_t_comment_txt.txt', 'TransText'), ( 'trans_t_deed_sec_cat_cd.txt', 'Trans'),
( 'trans_t_deed_sec_cat_cd.txt', 'TransAssignment'), ( 'trans_t_deed_sec_cat_cd.txt', 'TransDeed'),
( 'trans_t_deed_sec_cat_cd.txt', 'TransInvoluntaryLien'), ( 'trans_t_deed_sec_cat_cd.txt', 'TransLien'),
( 'trans_t_deed_sec_cat_cd.txt', 'TransPreForeclosure'), ( 'trans_t_deed_sec_cat_cd.txt', 'TransRelease'),
( 'trans_t_lot_info_grp.txt', 'Trans'), ( 'trans_t_lot_info_grp.txt', 'TransLot'), ( 'trans_t_mtg_grp_info_01.txt', 'Trans'),
( 'trans_t_mtg_grp_info_01.txt', 'TransAssignment'), ( 'trans_t_mtg_grp_info_01.txt', 'TransInvoluntaryLien'),
( 'trans_t_mtg_grp_info_01.txt', 'TransLien'), ( 'trans_t_mtg_grp_info_01.txt', 'TransPreForeclosureDetail'),
( 'trans_t_mtg_grp_info_01.txt', 'TransRelease'), ( 'trans_t_mtg_grp_info_01_comment.txt', 'Trans'),
( 'trans_t_mtg_grp_info_01_comment.txt', 'TransText'), ( 'trans_t_mtg_grp_info_01_int_rt.txt', 'Trans'),
( 'trans_t_mtg_grp_info_01_int_rt.txt', 'TransAssignment'), ( 'trans_t_mtg_grp_info_01_int_rt.txt', 'TransInvoluntaryLien'),
( 'trans_t_mtg_grp_info_01_int_rt.txt', 'TransLien'), ( 'trans_t_mtg_grp_info_01_int_rt.txt', 'TransPreForeclosureDetail'),
( 'trans_t_mtg_grp_info_01_int_rt.txt', 'TransRelease'), ( 'trans_t_mtg_grp_info_01_legal.txt', 'Trans'),
( 'trans_t_mtg_grp_info_01_legal.txt', 'TransLegalParty'), ( 'trans_t_mtg_grp_info_01_legal.txt', 'TransLegalPartyName'),
( 'trans_t_mtg_grp_info_01_legal.txt', 'TransLegalPartyParsed'), ( 'trans_t_mtg_grp_info_01_legal_addr.txt', 'Trans'),
( 'trans_t_mtg_grp_info_01_legal_addr.txt', 'TransLegalParty'), ( 'trans_t_mtg_grp_info_02.txt', 'Trans'),
( 'trans_t_mtg_grp_info_02.txt', 'TransAssignment'), ( 'trans_t_mtg_grp_info_02.txt', 'TransInvoluntaryLien'),
( 'trans_t_mtg_grp_info_02.txt', 'TransLien'), ( 'trans_t_mtg_grp_info_02.txt', 'TransPreForeclosureDetail'),
( 'trans_t_mtg_grp_info_02.txt', 'TransRelease'), ( 'trans_t_mtg_sec_cat_cd.txt', 'Trans'),
( 'trans_t_mtg_sec_cat_cd.txt', 'TransAssignment'), ( 'trans_t_mtg_sec_cat_cd.txt', 'TransInvoluntaryLien'),
( 'trans_t_mtg_sec_cat_cd.txt', 'TransLien'), ( 'trans_t_mtg_sec_cat_cd.txt', 'TransPreForeclosureDetail'),
( 'trans_t_mtg_sec_cat_cd.txt', 'TransRelease'), ( 'trans_t_prin_addr.txt', 'Trans'), ( 'trans_t_prin_addr.txt', 'TransLegalParty'),
( 'trans_t_sel_addr.txt', 'Trans'), ( 'trans_t_sel_addr.txt', 'TransLegalParty'), ( 'trans_t_sel_cd_tabl_grp.txt', 'Trans'),
( 'trans_t_sel_cd_tabl_grp.txt', 'TransLegalPartyName'), ( 'trans_t_sel_co_nm.txt', 'Trans'),
( 'trans_t_sel_co_nm.txt', 'TransLegalPartyName'), ( 'trans_t_sel_grp_info_01.txt', 'Trans'),
( 'trans_t_sel_grp_info_01.txt', 'TransLegalPartyParsed'), ( 'trans_t_sel_nm_grp.txt', 'Trans'),
( 'trans_t_sel_nm_grp.txt', 'TransLegalParty'), ( 'trans_t_sel_nm_grp.txt', 'TransLegalPartyName'),
( 'trans_t_sel_orig_addr.txt', 'Trans'), ( 'trans_t_sel_orig_addr.txt', 'TransLegalParty'), ( 'trans_t_sel_orig_nm.txt', 'Trans'),
( 'trans_t_sel_orig_nm.txt', 'TransLegalPartyOrigName'), ( 'trans_t_sit_dpvnote.txt', 'Trans'),
( 'trans_t_sit_dpvnote.txt', 'TransSitus'), ( 'trans_t_sit_grp_info_01.txt', 'Trans'),
( 'trans_t_sit_grp_info_01.txt', 'TransPcrFields'), ( 'trans_t_sit_grp_info_01.txt', 'TransSitus'),
( 'trans_t_sls_comment_txt.txt', 'Trans'), ( 'trans_t_sls_comment_txt.txt', 'TransText'), ( 'trans_t_sls_legal.txt', 'Trans'),
( 'trans_t_sls_legal.txt', 'TransPcrFields'), ( 'trans_t_sls_notes_txt.txt', 'Trans'), ( 'trans_t_sls_notes_txt.txt', 'TransText'),
( 'trans_t_sls_reject_grp_info_01.txt', 'Trans'), ( 'trans_t_sls_reject_grp_info_01.txt', 'TransReject'),
( 'trans_t_sq_ft_grp_info_01.txt', 'Trans'), ( 'trans_t_sq_ft_grp_info_01.txt', 'TransPcrFields'),
( 'trans_t_tax_exmp_grp_info_01.txt', 'Trans'), ( 'trans_t_tax_exmp_grp_info_01.txt', 'TransPcrFields') ) AS DiabloSpecTableMapping ([FlatFileName], [TableName]))
MERGE [dbo].[DiabloSpecTableMapping] AS t
USING DiabloSpecTableMapping AS s
ON t.[FlatFileName] = s.[FlatFileName]
AND t.[TableName] = s.[TableName]
WHEN NOT MATCHED
THEN
INSERT ([FlatFileName],
[TableName])
VALUES
(s.[FlatFileName],
s.[TableName]) ;