diff --git a/dal/import-79-raw.R b/dal/import-79-raw.R index d5ad44e..42ab498 100644 --- a/dal/import-79-raw.R +++ b/dal/import-79-raw.R @@ -28,24 +28,24 @@ columns_to_drop <- c("A0002600", "Y2267000") ds_extract <- tibble::tribble( ~schema , ~table_name , ~file_name - ,"Extract" , "tblGen1Explicit" , "nlsy79-gen1/Gen1Explicit.csv" - ,"Extract" , "tblGen1Implicit" , "nlsy79-gen1/Gen1Implicit.csv" - ,"Extract" , "tblGen1Links" , "nlsy79-gen1/Gen1Links.csv" - ,"Extract" , "tblGen1Outcomes" , "nlsy79-gen1/Gen1Outcomes.csv" - ,"Extract" , "tblGen1GeocodeSanitized" , "nlsy79-gen1/Gen1GeocodeSanitized.csv" - # "Process.tblLURosterGen1" , "nlsy79-gen1/RosterGen1.csv" + ,"Extract" , "tblGen1Explicit" , "nlsy79-gen1/Gen1Explicit" + ,"Extract" , "tblGen1Implicit" , "nlsy79-gen1/Gen1Implicit" + ,"Extract" , "tblGen1Links" , "nlsy79-gen1/Gen1Links" + ,"Extract" , "tblGen1Outcomes" , "nlsy79-gen1/Gen1Outcomes" + ,"Extract" , "tblGen1GeocodeSanitized" , "nlsy79-gen1/Gen1GeocodeSanitized" + # "Process.tblLURosterGen1" , "nlsy79-gen1/RosterGen1" # tblGen1MzDzDistinction2010 # - ,"Extract" , "tblGen2FatherFromGen1" , "nlsy79-gen2/Gen2FatherFromGen1.csv" - ,"Extract" , "tblGen2ImplicitFather" , "nlsy79-gen2/Gen2ImplicitFather.csv" - ,"Extract" , "tblGen2Links" , "nlsy79-gen2/Gen2Links.csv" - ,"Extract" , "tblGen2LinksFromGen1" , "nlsy79-gen2/Gen2LinksFromGen1.csv" - ,"Extract" , "tblGen2OutcomesHeight" , "nlsy79-gen2/Gen2OutcomesHeight.csv" - ,"Extract" , "tblGen2OutcomesMath" , "nlsy79-gen2/Gen2OutcomesMath.csv" - ,"Extract" , "tblGen2OutcomesWeight" , "nlsy79-gen2/Gen2OutcomesWeight.csv" + ,"Extract" , "tblGen2FatherFromGen1" , "nlsy79-gen2/Gen2FatherFromGen1" + ,"Extract" , "tblGen2ImplicitFather" , "nlsy79-gen2/Gen2ImplicitFather" + ,"Extract" , "tblGen2Links" , "nlsy79-gen2/Gen2Links" + ,"Extract" , "tblGen2LinksFromGen1" , "nlsy79-gen2/Gen2LinksFromGen1" + ,"Extract" , "tblGen2OutcomesHeight" , "nlsy79-gen2/Gen2OutcomesHeight" + ,"Extract" , "tblGen2OutcomesMath" , "nlsy79-gen2/Gen2OutcomesMath" + ,"Extract" , "tblGen2OutcomesWeight" , "nlsy79-gen2/Gen2OutcomesWeight" - ,"Extract" , "tblGen2FatherFromGen1Death" , "nlsy79-gen2/Gen2FatherFromGen1Death.csv" + ,"Extract" , "tblGen2FatherFromGen1Death" , "nlsy79-gen2/Gen2FatherFromGen1Death" # "Extract" , "tbl97Roster" , "nlsy97/97-roster.csv" ) @@ -57,22 +57,43 @@ col_types_default <- readr::cols( checkmate::assert_character(ds_extract$table_name , min.chars=10, any.missing=F, unique=T) checkmate::assert_character(ds_extract$file_name , min.chars=10, any.missing=F, unique=T) +sql_template_primary_key <- " + ALTER TABLE {table_name_qualified} ADD CONSTRAINT + PK_{table_name} PRIMARY KEY CLUSTERED ( R0000100 ) + WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] +" + # ---- load-data --------------------------------------------------------------- start_time <- Sys.time() +ds_inventory <- database_inventory(study) + ds_extract <- ds_extract %>% dplyr::mutate( - path = file.path(directory_in, file_name), - extract_exist = file.exists(path), - table_name_qualified = paste0(schema, ".", table_name), - sql_select = glue::glue("SELECT TOP(100) * FROM {table_name_qualified}"), - sql_truncate = glue::glue("TRUNCATE TABLE {table_name_qualified}") + table_name_qualified = paste0(schema, ".", table_name), + table_name = sub("^Extract\\.(\\w+)$", "\\1", table_name_qualified), + path_zip = file.path(directory_in, paste0(file_name, ".zip")), + name_csv = paste0(file_name, ".csv"), + # path_csv = file.path(directory_in, name_csv), + extract_exist = file.exists(path_zip), + sql_select = glue::glue("SELECT TOP(100) * FROM {table_name_qualified}"), + sql_truncate = glue::glue("TRUNCATE TABLE {table_name_qualified}"), + # sql_not_null = glue::glue(sql_template_not_null), + sql_primary_key = glue::glue(sql_template_primary_key) ) testit::assert("All files should be found.", all(ds_extract$extract_exist)) print(ds_extract, n=20) +ds_extract %>% + dplyr::select(table_name_qualified, path_zip) %>% + print(n=20) + # ---- tweak-data -------------------------------------------------------------- +ds_inventory <- ds_inventory %>% + dplyr::mutate( + table_name_qualified = glue::glue("{schema_name}.{table_name}") + ) # ---- verify-values ----------------------------------------------------------- # Sniff out problems @@ -87,87 +108,106 @@ DBI::dbGetInfo(channel_odbc) channel_rodbc <- open_dsn_channel_rodbc(study) -for( i in seq_len(nrow(ds_extract)) ) { # i <- 13L - message(glue::glue("Uploading from `{ds_extract$file_name[i]}` to `{ds_extract$table_name_qualified[i]}`.")) +for( i in seq_len(nrow(ds_extract)) ) { # i <- 1L + # for( i in 1 ) { # i <- 1L + message(glue::glue("Uploading from `{ds_extract$path_zip[i]}` to `{ds_extract$table_name_qualified[i]}`.")) - d <- readr::read_csv(ds_extract$path[i], col_types=col_types_default) + # Create temp zip file + temp_directory <- tempdir() # file.path(tempdir(), dirname(ds_extract$name_csv[i])) + temp_csv <- file.path(temp_directory, ds_extract$name_csv[i]) + utils::unzip(ds_extract$path_zip[i], files=basename(ds_extract$name_csv[i]), exdir=file.path(tempdir(), dirname(ds_extract$name_csv[i]))) + if( !file.exists(temp_csv) ) stop("The decompressed csv, `", temp_csv, "` was not found.") - columns_to_drop_specific <- colnames(d) %>% - intersect(columns_to_drop) - # %>% - # glue::glue("{.}") + # Read the temp csv, and delete it + # d <- readr::read_csv(ds_extract$path_csv[i], col_types=col_types_default) + d <- readr::read_csv(temp_csv, col_types=col_types_default) + unlink(temp_csv); + # Drop pre-specified columns from all extracts + columns_to_drop_specific <- intersect(colnames(d), columns_to_drop) if( length(columns_to_drop_specific) >= 1L ) { d <- d %>% dplyr::select_(.dots=paste0("-", columns_to_drop_specific)) } + # Print diagnostic info # print(dim(d)) # purrr::map_chr(d, class) print(d, n=20) - #RODBC::sqlQuery(channel_odbc, ds_extract$sql_truncate[i], errors=FALSE) - # d_peek <- RODBC::sqlQuery(channel_odbc, ds_extract$sql_select[i], errors=FALSE) - - DBI::dbGetQuery(channel_odbc, ds_extract$sql_truncate[i]) - - d_peek <- DBI::dbGetQuery(channel_odbc, ds_extract$sql_select[i]) - peek <- colnames(d_peek) - # peek <- DBI::dbListFields(channel_odbc, ds_extract$table_name_qualified[i]) - - missing_in_extract <- setdiff(peek , colnames(d)) - missing_in_database <- setdiff(colnames(d), peek ) - - # d_column <- tibble::tibble( - # db = colnames(d), - # extract = peek - # ) %>% - # dplyr::filter(db != extract) - - # system.time({ - # DBI::dbWriteTable( - # conn = channel_odbc, - # name = DBI::SQL(ds_extract$table_name[i]), - # value = d, #[, 1:10], - # # append = T, - # overwrite = T - # ) - # }) - - system.time({ - RODBC::sqlSave( - channel = channel_rodbc, - dat = d, - tablename = ds_extract$table_name_qualified[i], - safer = FALSE, # Don't keep the existing table. - rownames = FALSE, - append = TRUE - ) %>% - print() - }) - - # system.time({ - # DBI::dbWriteTable( - # conn = channel_odbc, - # name = DBI::Id(schema=ds_extract$schema[i], table=ds_extract$table_name[i]), - # value = d, - # overwrite = FALSE, - # append = TRUE - # ) %>% - # print() - # }) - - # OuhscMunge::upload_sqls_rodbc( - # d = d[1:100, ], - # table_name = ds_extract$table_name_qualified[i] , - # dsn_name = "local-nlsy-links-79", - # clear_table = F, - # create_table = T - # ) - + # Write the table to the database. Different operations, depending if the table existings already. + if( ds_extract$table_name_qualified[i] %in% ds_inventory$table_name_qualified ) { + #RODBC::sqlQuery(channel_odbc, ds_extract$sql_truncate[i], errors=FALSE) + # d_peek <- RODBC::sqlQuery(channel_odbc, ds_extract$sql_select[i], errors=FALSE) + + # Remove existing records + DBI::dbGetQuery(channel_odbc, ds_extract$sql_truncate[i]) + + # Compare columns in the database table and in the extract. + d_peek <- DBI::dbGetQuery(channel_odbc, ds_extract$sql_select[i]) + peek <- colnames(d_peek) + # peek <- DBI::dbListFields(channel_odbc, ds_extract$table_name_qualified[i]) + missing_in_extract <- setdiff(peek , colnames(d)) + missing_in_database <- setdiff(colnames(d), peek ) + testit::assert("All columns in the database should be in the extract.", length(missing_in_extract )==0L) + testit::assert("All columns in the extract should be in the database.", length(missing_in_database)==0L) + + # Write to the database + RODBC::sqlSave( + channel = channel_rodbc, + dat = d, + tablename = ds_extract$table_name_qualified[i], + safer = FALSE, # Don't keep the existing table. + rownames = FALSE, + append = TRUE + ) %>% + print() + + # I'd like to use the odbc package, but it's still having problems with schema names. + # system.time({ + # DBI::dbWriteTable( + # conn = channel_odbc, + # name = DBI::SQL(ds_extract$table_name_qualified[i]), + # value = d, #[, 1:10], + # # append = T, + # overwrite = T + # ) + # }) + + } else { + # If the table doesn't already exist in the database, create it. + OuhscMunge::upload_sqls_rodbc( + d = d, + # d = d[1:100, ], + table_name = ds_extract$table_name_qualified[i] , + dsn_name = "local-nlsy-links-79", + clear_table = F, + create_table = T + ) + + colnames(d) + + sql_template_not_null <- " + ALTER TABLE {table_name_qualified} ALTER COLUMN [{variable_code}] INTEGER NOT NULL + " + # sql_template_not_null <- " + # ALTER TABLE {%s} ALTER COLUMN [{%s}] INTEGER NOT NULL + # " + sql_not_null <- glue::glue(sql_template_not_null, table_name_qualified=ds_extract$table_name_qualified[i] , variable_code=colnames(d)) + sql_not_null <- paste(sql_not_null, collapse="; ") + # sql_not_null <- sprintf(sql_template_not_null, table_name_qualified=ds_extract$table_name_qualified[i] , variable_code=colnames(d)) + # sql_not_null + + + # Make the subject id the primary key. + # DBI::dbGetQuery(channel_odbc, ds_extract$sql_not_null[i]) + DBI::dbGetQuery(channel_odbc, sql_not_null) + DBI::dbGetQuery(channel_odbc, ds_extract$sql_primary_key[i]) + } message(glue::glue("Tibble size: {format(object.size(d), units='MB')}")) } +# Diconnect the connections/channels. DBI::dbDisconnect(channel_odbc); rm(channel_odbc) RODBC::odbcClose(channel_rodbc); rm(channel_rodbc) diff --git a/dal/import-97-raw.R b/dal/import-97-raw.R index a60a173..3083ae6 100644 --- a/dal/import-97-raw.R +++ b/dal/import-97-raw.R @@ -58,10 +58,10 @@ sql_template_primary_key <- " " # ---- load-data --------------------------------------------------------------- -ds_inventory <- database_inventory(study) - start_time <- Sys.time() +ds_inventory <- database_inventory(study) + ds_extract <- ds_extract %>% dplyr::mutate( table_name = sub("^Extract\\.(\\w+)$", "\\1", table_name_qualified), @@ -88,11 +88,6 @@ ds_inventory <- ds_inventory %>% table_name_qualified = glue::glue("{schema_name}.{table_name}") ) - -# ---- inspect ----------------------------------------------------------------- - - - # ---- verify-values ----------------------------------------------------------- # Sniff out problems @@ -133,7 +128,7 @@ for( i in seq_len(nrow(ds_extract)) ) { # i <- 1L # purrr::map_chr(d, class) print(d, n=20) - # Write the table to teh database. Different operations, depending if the table existings already. + # Write the table to the database. Different operations, depending if the table existings already. if( ds_extract$table_name_qualified[i] %in% ds_inventory$table_name_qualified ) { #RODBC::sqlQuery(channel_odbc, ds_extract$sql_truncate[i], errors=FALSE) # d_peek <- RODBC::sqlQuery(channel_odbc, ds_extract$sql_select[i], errors=FALSE) @@ -147,7 +142,7 @@ for( i in seq_len(nrow(ds_extract)) ) { # i <- 1L # peek <- DBI::dbListFields(channel_odbc, ds_extract$table_name_qualified[i]) missing_in_extract <- setdiff(peek , colnames(d)) missing_in_database <- setdiff(colnames(d), peek ) - testit::assert("All columns in the database should be in the extract.", length(missing_in_extract )==0L ) + testit::assert("All columns in the database should be in the extract.", length(missing_in_extract )==0L) testit::assert("All columns in the extract should be in the database.", length(missing_in_database)==0L) # Write to the database diff --git a/data-public/metadata/database/generate-db-79.sql b/data-public/metadata/database/generate-db-79.sql index a14fa0c..2f55399 100644 --- a/data-public/metadata/database/generate-db-79.sql +++ b/data-public/metadata/database/generate-db-79.sql @@ -1314,23 +1314,10 @@ CREATE TABLE [Extract].[tblGen1Links]( [T2260600] [int] NULL, [T2260601] [int] NULL, [T2260602] [int] NULL, - [T2763400] [int] NULL, - [T2763500] [int] NULL, - [T2763600] [int] NULL, - [T2763700] [int] NULL, - [T2763800] [int] NULL, - [T2763900] [int] NULL, - [T2764000] [int] NULL, [T3108700] [int] NULL, [T3195600] [int] NULL, [T3195601] [int] NULL, [T3195602] [int] NULL, - [T3729600] [int] NULL, - [T3729700] [int] NULL, - [T3729800] [int] NULL, - [T3729900] [int] NULL, - [T3730000] [int] NULL, - [T3730100] [int] NULL, [T4113200] [int] NULL, [T4181100] [int] NULL, [T4181101] [int] NULL, @@ -2195,323 +2182,324 @@ SET QUOTED_IDENTIFIER ON GO CREATE TABLE [Extract].[tblGen2FatherFromGen1Death]( [R0000100] [int] NOT NULL, - [R0214700] [int] NULL, - [R1373400] [int] NULL, - [R1374100] [int] NULL, - [R1374800] [int] NULL, - [R1375500] [int] NULL, - [R1376200] [int] NULL, - [R1376900] [int] NULL, - [R1377600] [int] NULL, - [R1753800] [int] NULL, - [R1754500] [int] NULL, - [R1755200] [int] NULL, - [R1755900] [int] NULL, - [R1756600] [int] NULL, - [R1757300] [int] NULL, - [R1758000] [int] NULL, - [R2095800] [int] NULL, - [R2096500] [int] NULL, - [R2097200] [int] NULL, - [R2097900] [int] NULL, - [R2098600] [int] NULL, - [R2099300] [int] NULL, - [R2100000] [int] NULL, - [R2648100] [int] NULL, - [R2648800] [int] NULL, - [R2649500] [int] NULL, - [R2650200] [int] NULL, - [R2650900] [int] NULL, - [R2651600] [int] NULL, - [R2652300] [int] NULL, - [R3256000] [int] NULL, - [R3257800] [int] NULL, - [R3259600] [int] NULL, - [R3261400] [int] NULL, - [R3263200] [int] NULL, - [R3265000] [int] NULL, - [R3266800] [int] NULL, - [R3771900] [int] NULL, - [R3772200] [int] NULL, - [R3772300] [int] NULL, - [R3774000] [int] NULL, - [R3774300] [int] NULL, - [R3774400] [int] NULL, - [R3776100] [int] NULL, - [R3776400] [int] NULL, - [R3776500] [int] NULL, - [R3778200] [int] NULL, - [R3778500] [int] NULL, - [R3778600] [int] NULL, - [R3780300] [int] NULL, - [R3780600] [int] NULL, - [R3780700] [int] NULL, - [R3782400] [int] NULL, - [R3784500] [int] NULL, - [R4276900] [int] NULL, - [R4277200] [int] NULL, - [R4277201] [int] NULL, - [R4277800] [int] NULL, - [R4278100] [int] NULL, - [R4278101] [int] NULL, - [R4278700] [int] NULL, - [R4279000] [int] NULL, - [R4279001] [int] NULL, - [R4279600] [int] NULL, - [R4279900] [int] NULL, - [R4279901] [int] NULL, - [R4280500] [int] NULL, - [R4280800] [int] NULL, - [R4280801] [int] NULL, - [R4281400] [int] NULL, - [R4282200] [int] NULL, - [R4827700] [int] NULL, - [R4828000] [int] NULL, - [R4828001] [int] NULL, - [R4830700] [int] NULL, - [R4831000] [int] NULL, - [R4831001] [int] NULL, - [R4833700] [int] NULL, - [R4834000] [int] NULL, - [R4834001] [int] NULL, - [R4836700] [int] NULL, - [R4837000] [int] NULL, - [R4837001] [int] NULL, - [R4839700] [int] NULL, - [R4840000] [int] NULL, - [R4840001] [int] NULL, - [R4842600] [int] NULL, - [R4844900] [int] NULL, - [R4847200] [int] NULL, - [R5498100] [int] NULL, - [R5498400] [int] NULL, - [R5498401] [int] NULL, - [R5501100] [int] NULL, - [R5501400] [int] NULL, - [R5501401] [int] NULL, - [R5504100] [int] NULL, - [R5504400] [int] NULL, - [R5504401] [int] NULL, - [R5507100] [int] NULL, - [R5507400] [int] NULL, - [R5507401] [int] NULL, - [R5510100] [int] NULL, - [R5510400] [int] NULL, - [R5510401] [int] NULL, - [R5513100] [int] NULL, - [R5515400] [int] NULL, - [R5517700] [int] NULL, - [R5519900] [int] NULL, - [R6219500] [int] NULL, - [R6219600] [int] NULL, - [R6219700] [int] NULL, - [R6219800] [int] NULL, - [R6219900] [int] NULL, - [R6220000] [int] NULL, - [R6220100] [int] NULL, - [R6220200] [int] NULL, - [R6220300] [int] NULL, - [R6220400] [int] NULL, - [R6222800] [int] NULL, - [R6222801] [int] NULL, - [R6222900] [int] NULL, - [R6222901] [int] NULL, - [R6223000] [int] NULL, - [R6223001] [int] NULL, - [R6223100] [int] NULL, - [R6223101] [int] NULL, - [R6223200] [int] NULL, - [R6223201] [int] NULL, - [R6223300] [int] NULL, - [R6223301] [int] NULL, - [R6773500] [int] NULL, - [R6773600] [int] NULL, - [R6773700] [int] NULL, - [R6773800] [int] NULL, - [R6773900] [int] NULL, - [R6774000] [int] NULL, - [R6774100] [int] NULL, - [R6774200] [int] NULL, - [R6774300] [int] NULL, - [R6774400] [int] NULL, - [R6776300] [int] NULL, - [R6776301] [int] NULL, - [R6776400] [int] NULL, - [R6776401] [int] NULL, - [R6776500] [int] NULL, - [R6776501] [int] NULL, - [R6776600] [int] NULL, - [R6776601] [int] NULL, - [R6776700] [int] NULL, - [R6776701] [int] NULL, - [R6776800] [int] NULL, - [R6776801] [int] NULL, - [R7417900] [int] NULL, - [R7418000] [int] NULL, - [R7418100] [int] NULL, - [R7418200] [int] NULL, - [R7418300] [int] NULL, - [R7418400] [int] NULL, - [R7418500] [int] NULL, - [R7418600] [int] NULL, - [R7418700] [int] NULL, - [R7418800] [int] NULL, - [R7420700] [int] NULL, - [R7420701] [int] NULL, - [R7420800] [int] NULL, - [R7420801] [int] NULL, - [R7420900] [int] NULL, - [R7420901] [int] NULL, - [R7421000] [int] NULL, - [R7421001] [int] NULL, - [R7421100] [int] NULL, - [R7421101] [int] NULL, - [R7421200] [int] NULL, - [R7421201] [int] NULL, - [R7421300] [int] NULL, - [R7421301] [int] NULL, - [R8116000] [int] NULL, - [R8116100] [int] NULL, - [R8116200] [int] NULL, - [R8116300] [int] NULL, - [R8116400] [int] NULL, - [R8116500] [int] NULL, - [R8116600] [int] NULL, - [R8116700] [int] NULL, - [R8116800] [int] NULL, - [R8116900] [int] NULL, - [R8119000] [int] NULL, - [R8119001] [int] NULL, - [R8119100] [int] NULL, - [R8119101] [int] NULL, - [R8119200] [int] NULL, - [R8119201] [int] NULL, - [R8119300] [int] NULL, - [R8119301] [int] NULL, - [R8119400] [int] NULL, - [R8119401] [int] NULL, - [R8119500] [int] NULL, - [R8119501] [int] NULL, - [T0347900] [int] NULL, - [T0348000] [int] NULL, - [T0348100] [int] NULL, - [T0348200] [int] NULL, - [T0348300] [int] NULL, - [T0348400] [int] NULL, - [T0348500] [int] NULL, - [T0348600] [int] NULL, - [T0348700] [int] NULL, - [T0348800] [int] NULL, - [T0348900] [int] NULL, - [T0351100] [int] NULL, - [T0351101] [int] NULL, - [T0351200] [int] NULL, - [T0351201] [int] NULL, - [T0351300] [int] NULL, - [T0351301] [int] NULL, - [T0351400] [int] NULL, - [T0351401] [int] NULL, - [T0351500] [int] NULL, - [T0351501] [int] NULL, - [T0351600] [int] NULL, - [T0351601] [int] NULL, - [T0351700] [int] NULL, - [T0351701] [int] NULL, - [T0351800] [int] NULL, - [T0351801] [int] NULL, - [T1497300] [int] NULL, - [T1497400] [int] NULL, - [T1497500] [int] NULL, - [T1497600] [int] NULL, - [T1497700] [int] NULL, - [T1497800] [int] NULL, - [T1497900] [int] NULL, - [T1498000] [int] NULL, - [T1498100] [int] NULL, - [T1498200] [int] NULL, - [T1498300] [int] NULL, - [T1500500] [int] NULL, - [T1500501] [int] NULL, - [T1500600] [int] NULL, - [T1500601] [int] NULL, - [T1500700] [int] NULL, - [T1500701] [int] NULL, - [T1500800] [int] NULL, - [T1500801] [int] NULL, - [T1500900] [int] NULL, - [T1500901] [int] NULL, - [T1501000] [int] NULL, - [T1501001] [int] NULL, - [T2543200] [int] NULL, - [T2543300] [int] NULL, - [T2543400] [int] NULL, - [T2543500] [int] NULL, - [T2543600] [int] NULL, - [T2543700] [int] NULL, - [T2543800] [int] NULL, - [T2543900] [int] NULL, - [T2544000] [int] NULL, - [T2544100] [int] NULL, - [T2546100] [int] NULL, - [T2546101] [int] NULL, - [T2546200] [int] NULL, - [T2546201] [int] NULL, - [T2546300] [int] NULL, - [T2546301] [int] NULL, - [T2546400] [int] NULL, - [T2546401] [int] NULL, - [T2546500] [int] NULL, - [T2546501] [int] NULL, - [T2546600] [int] NULL, - [T2546601] [int] NULL, - [T2546700] [int] NULL, - [T2546701] [int] NULL, - [T3529500] [int] NULL, - [T3529600] [int] NULL, - [T3529700] [int] NULL, - [T3529800] [int] NULL, - [T3529900] [int] NULL, - [T3530000] [int] NULL, - [T3530100] [int] NULL, - [T3530200] [int] NULL, - [T3530300] [int] NULL, - [T3530400] [int] NULL, - [T3532500] [int] NULL, - [T3532501] [int] NULL, - [T3532600] [int] NULL, - [T3532601] [int] NULL, - [T3532700] [int] NULL, - [T3532701] [int] NULL, - [T3532800] [int] NULL, - [T3532801] [int] NULL, - [T3532900] [int] NULL, - [T3532901] [int] NULL, - [T3533000] [int] NULL, - [T3533001] [int] NULL, - [T3533100] [int] NULL, - [T3533101] [int] NULL, - [T4498100] [int] NULL, - [T4498200] [int] NULL, - [T4498300] [int] NULL, - [T4498400] [int] NULL, - [T4498500] [int] NULL, - [T4498600] [int] NULL, - [T4498700] [int] NULL, - [T4498800] [int] NULL, - [T4498900] [int] NULL, - [T4499000] [int] NULL, - [T4503700] [int] NULL, - [T4503701] [int] NULL, - [T4503800] [int] NULL, - [T4503801] [int] NULL, - [T4503900] [int] NULL, - [T4503901] [int] NULL, - [T4504000] [int] NULL, - [T4504001] [int] NULL, - [T4504100] [int] NULL, - [T4504101] [int] NULL, - [T4504200] [int] NULL, - [T4504201] [int] NULL, + [R0000149] [int] NOT NULL, + [R0214800] [int] NOT NULL, + [R1373400] [int] NOT NULL, + [R1374100] [int] NOT NULL, + [R1374800] [int] NOT NULL, + [R1375500] [int] NOT NULL, + [R1376200] [int] NOT NULL, + [R1376900] [int] NOT NULL, + [R1377600] [int] NOT NULL, + [R1753800] [int] NOT NULL, + [R1754500] [int] NOT NULL, + [R1755200] [int] NOT NULL, + [R1755900] [int] NOT NULL, + [R1756600] [int] NOT NULL, + [R1757300] [int] NOT NULL, + [R1758000] [int] NOT NULL, + [R2095800] [int] NOT NULL, + [R2096500] [int] NOT NULL, + [R2097200] [int] NOT NULL, + [R2097900] [int] NOT NULL, + [R2098600] [int] NOT NULL, + [R2099300] [int] NOT NULL, + [R2100000] [int] NOT NULL, + [R2648100] [int] NOT NULL, + [R2648800] [int] NOT NULL, + [R2649500] [int] NOT NULL, + [R2650200] [int] NOT NULL, + [R2650900] [int] NOT NULL, + [R2651600] [int] NOT NULL, + [R2652300] [int] NOT NULL, + [R3256000] [int] NOT NULL, + [R3257800] [int] NOT NULL, + [R3259600] [int] NOT NULL, + [R3261400] [int] NOT NULL, + [R3263200] [int] NOT NULL, + [R3265000] [int] NOT NULL, + [R3266800] [int] NOT NULL, + [R3771900] [int] NOT NULL, + [R3772200] [int] NOT NULL, + [R3772300] [int] NOT NULL, + [R3774000] [int] NOT NULL, + [R3774300] [int] NOT NULL, + [R3774400] [int] NOT NULL, + [R3776100] [int] NOT NULL, + [R3776400] [int] NOT NULL, + [R3776500] [int] NOT NULL, + [R3778200] [int] NOT NULL, + [R3778500] [int] NOT NULL, + [R3778600] [int] NOT NULL, + [R3780300] [int] NOT NULL, + [R3780600] [int] NOT NULL, + [R3780700] [int] NOT NULL, + [R3782400] [int] NOT NULL, + [R3784500] [int] NOT NULL, + [R4276900] [int] NOT NULL, + [R4277200] [int] NOT NULL, + [R4277201] [int] NOT NULL, + [R4277800] [int] NOT NULL, + [R4278100] [int] NOT NULL, + [R4278101] [int] NOT NULL, + [R4278700] [int] NOT NULL, + [R4279000] [int] NOT NULL, + [R4279001] [int] NOT NULL, + [R4279600] [int] NOT NULL, + [R4279900] [int] NOT NULL, + [R4279901] [int] NOT NULL, + [R4280500] [int] NOT NULL, + [R4280800] [int] NOT NULL, + [R4280801] [int] NOT NULL, + [R4281400] [int] NOT NULL, + [R4282200] [int] NOT NULL, + [R4827700] [int] NOT NULL, + [R4828000] [int] NOT NULL, + [R4828001] [int] NOT NULL, + [R4830700] [int] NOT NULL, + [R4831000] [int] NOT NULL, + [R4831001] [int] NOT NULL, + [R4833700] [int] NOT NULL, + [R4834000] [int] NOT NULL, + [R4834001] [int] NOT NULL, + [R4836700] [int] NOT NULL, + [R4837000] [int] NOT NULL, + [R4837001] [int] NOT NULL, + [R4839700] [int] NOT NULL, + [R4840000] [int] NOT NULL, + [R4840001] [int] NOT NULL, + [R4842600] [int] NOT NULL, + [R4844900] [int] NOT NULL, + [R4847200] [int] NOT NULL, + [R5498100] [int] NOT NULL, + [R5498400] [int] NOT NULL, + [R5498401] [int] NOT NULL, + [R5501100] [int] NOT NULL, + [R5501400] [int] NOT NULL, + [R5501401] [int] NOT NULL, + [R5504100] [int] NOT NULL, + [R5504400] [int] NOT NULL, + [R5504401] [int] NOT NULL, + [R5507100] [int] NOT NULL, + [R5507400] [int] NOT NULL, + [R5507401] [int] NOT NULL, + [R5510100] [int] NOT NULL, + [R5510400] [int] NOT NULL, + [R5510401] [int] NOT NULL, + [R5513100] [int] NOT NULL, + [R5515400] [int] NOT NULL, + [R5517700] [int] NOT NULL, + [R5519900] [int] NOT NULL, + [R6219500] [int] NOT NULL, + [R6219600] [int] NOT NULL, + [R6219700] [int] NOT NULL, + [R6219800] [int] NOT NULL, + [R6219900] [int] NOT NULL, + [R6220000] [int] NOT NULL, + [R6220100] [int] NOT NULL, + [R6220200] [int] NOT NULL, + [R6220300] [int] NOT NULL, + [R6220400] [int] NOT NULL, + [R6222800] [int] NOT NULL, + [R6222801] [int] NOT NULL, + [R6222900] [int] NOT NULL, + [R6222901] [int] NOT NULL, + [R6223000] [int] NOT NULL, + [R6223001] [int] NOT NULL, + [R6223100] [int] NOT NULL, + [R6223101] [int] NOT NULL, + [R6223200] [int] NOT NULL, + [R6223201] [int] NOT NULL, + [R6223300] [int] NOT NULL, + [R6223301] [int] NOT NULL, + [R6773500] [int] NOT NULL, + [R6773600] [int] NOT NULL, + [R6773700] [int] NOT NULL, + [R6773800] [int] NOT NULL, + [R6773900] [int] NOT NULL, + [R6774000] [int] NOT NULL, + [R6774100] [int] NOT NULL, + [R6774200] [int] NOT NULL, + [R6774300] [int] NOT NULL, + [R6774400] [int] NOT NULL, + [R6776300] [int] NOT NULL, + [R6776301] [int] NOT NULL, + [R6776400] [int] NOT NULL, + [R6776401] [int] NOT NULL, + [R6776500] [int] NOT NULL, + [R6776501] [int] NOT NULL, + [R6776600] [int] NOT NULL, + [R6776601] [int] NOT NULL, + [R6776700] [int] NOT NULL, + [R6776701] [int] NOT NULL, + [R6776800] [int] NOT NULL, + [R6776801] [int] NOT NULL, + [R7417900] [int] NOT NULL, + [R7418000] [int] NOT NULL, + [R7418100] [int] NOT NULL, + [R7418200] [int] NOT NULL, + [R7418300] [int] NOT NULL, + [R7418400] [int] NOT NULL, + [R7418500] [int] NOT NULL, + [R7418600] [int] NOT NULL, + [R7418700] [int] NOT NULL, + [R7418800] [int] NOT NULL, + [R7420700] [int] NOT NULL, + [R7420701] [int] NOT NULL, + [R7420800] [int] NOT NULL, + [R7420801] [int] NOT NULL, + [R7420900] [int] NOT NULL, + [R7420901] [int] NOT NULL, + [R7421000] [int] NOT NULL, + [R7421001] [int] NOT NULL, + [R7421100] [int] NOT NULL, + [R7421101] [int] NOT NULL, + [R7421200] [int] NOT NULL, + [R7421201] [int] NOT NULL, + [R7421300] [int] NOT NULL, + [R7421301] [int] NOT NULL, + [R8116000] [int] NOT NULL, + [R8116100] [int] NOT NULL, + [R8116200] [int] NOT NULL, + [R8116300] [int] NOT NULL, + [R8116400] [int] NOT NULL, + [R8116500] [int] NOT NULL, + [R8116600] [int] NOT NULL, + [R8116700] [int] NOT NULL, + [R8116800] [int] NOT NULL, + [R8116900] [int] NOT NULL, + [R8119000] [int] NOT NULL, + [R8119001] [int] NOT NULL, + [R8119100] [int] NOT NULL, + [R8119101] [int] NOT NULL, + [R8119200] [int] NOT NULL, + [R8119201] [int] NOT NULL, + [R8119300] [int] NOT NULL, + [R8119301] [int] NOT NULL, + [R8119400] [int] NOT NULL, + [R8119401] [int] NOT NULL, + [R8119500] [int] NOT NULL, + [R8119501] [int] NOT NULL, + [T0347900] [int] NOT NULL, + [T0348000] [int] NOT NULL, + [T0348100] [int] NOT NULL, + [T0348200] [int] NOT NULL, + [T0348300] [int] NOT NULL, + [T0348400] [int] NOT NULL, + [T0348500] [int] NOT NULL, + [T0348600] [int] NOT NULL, + [T0348700] [int] NOT NULL, + [T0348800] [int] NOT NULL, + [T0348900] [int] NOT NULL, + [T0351100] [int] NOT NULL, + [T0351101] [int] NOT NULL, + [T0351200] [int] NOT NULL, + [T0351201] [int] NOT NULL, + [T0351300] [int] NOT NULL, + [T0351301] [int] NOT NULL, + [T0351400] [int] NOT NULL, + [T0351401] [int] NOT NULL, + [T0351500] [int] NOT NULL, + [T0351501] [int] NOT NULL, + [T0351600] [int] NOT NULL, + [T0351601] [int] NOT NULL, + [T0351700] [int] NOT NULL, + [T0351701] [int] NOT NULL, + [T0351800] [int] NOT NULL, + [T0351801] [int] NOT NULL, + [T1497300] [int] NOT NULL, + [T1497400] [int] NOT NULL, + [T1497500] [int] NOT NULL, + [T1497600] [int] NOT NULL, + [T1497700] [int] NOT NULL, + [T1497800] [int] NOT NULL, + [T1497900] [int] NOT NULL, + [T1498000] [int] NOT NULL, + [T1498100] [int] NOT NULL, + [T1498200] [int] NOT NULL, + [T1498300] [int] NOT NULL, + [T1500500] [int] NOT NULL, + [T1500501] [int] NOT NULL, + [T1500600] [int] NOT NULL, + [T1500601] [int] NOT NULL, + [T1500700] [int] NOT NULL, + [T1500701] [int] NOT NULL, + [T1500800] [int] NOT NULL, + [T1500801] [int] NOT NULL, + [T1500900] [int] NOT NULL, + [T1500901] [int] NOT NULL, + [T1501000] [int] NOT NULL, + [T1501001] [int] NOT NULL, + [T2543200] [int] NOT NULL, + [T2543300] [int] NOT NULL, + [T2543400] [int] NOT NULL, + [T2543500] [int] NOT NULL, + [T2543600] [int] NOT NULL, + [T2543700] [int] NOT NULL, + [T2543800] [int] NOT NULL, + [T2543900] [int] NOT NULL, + [T2544000] [int] NOT NULL, + [T2544100] [int] NOT NULL, + [T2546100] [int] NOT NULL, + [T2546101] [int] NOT NULL, + [T2546200] [int] NOT NULL, + [T2546201] [int] NOT NULL, + [T2546300] [int] NOT NULL, + [T2546301] [int] NOT NULL, + [T2546400] [int] NOT NULL, + [T2546401] [int] NOT NULL, + [T2546500] [int] NOT NULL, + [T2546501] [int] NOT NULL, + [T2546600] [int] NOT NULL, + [T2546601] [int] NOT NULL, + [T2546700] [int] NOT NULL, + [T2546701] [int] NOT NULL, + [T3529500] [int] NOT NULL, + [T3529600] [int] NOT NULL, + [T3529700] [int] NOT NULL, + [T3529800] [int] NOT NULL, + [T3529900] [int] NOT NULL, + [T3530000] [int] NOT NULL, + [T3530100] [int] NOT NULL, + [T3530200] [int] NOT NULL, + [T3530300] [int] NOT NULL, + [T3530400] [int] NOT NULL, + [T3532500] [int] NOT NULL, + [T3532501] [int] NOT NULL, + [T3532600] [int] NOT NULL, + [T3532601] [int] NOT NULL, + [T3532700] [int] NOT NULL, + [T3532701] [int] NOT NULL, + [T3532800] [int] NOT NULL, + [T3532801] [int] NOT NULL, + [T3532900] [int] NOT NULL, + [T3532901] [int] NOT NULL, + [T3533000] [int] NOT NULL, + [T3533001] [int] NOT NULL, + [T3533100] [int] NOT NULL, + [T3533101] [int] NOT NULL, + [T4498100] [int] NOT NULL, + [T4498200] [int] NOT NULL, + [T4498300] [int] NOT NULL, + [T4498400] [int] NOT NULL, + [T4498500] [int] NOT NULL, + [T4498600] [int] NOT NULL, + [T4498700] [int] NOT NULL, + [T4498800] [int] NOT NULL, + [T4498900] [int] NOT NULL, + [T4499000] [int] NOT NULL, + [T4503700] [int] NOT NULL, + [T4503701] [int] NOT NULL, + [T4503800] [int] NOT NULL, + [T4503801] [int] NOT NULL, + [T4503900] [int] NOT NULL, + [T4503901] [int] NOT NULL, + [T4504000] [int] NOT NULL, + [T4504001] [int] NOT NULL, + [T4504100] [int] NOT NULL, + [T4504101] [int] NOT NULL, + [T4504200] [int] NOT NULL, + [T4504201] [int] NOT NULL, CONSTRAINT [PK_tblGen2FatherFromGen1Death] PRIMARY KEY CLUSTERED ( [R0000100] ASC