Returns a data.frame as returned by sqlTables, containing information on the tables contained in the database. Opening of the database connection, getting the list of tables and closing of the database connection is done within this function.
Usage
hsTables(
mdb,
excludeSystemTables = grepl("\\.(mdb|accdb)$", mdb),
namesOnly = TRUE,
use2007Driver = NULL,
dbg = FALSE
)
Arguments
- mdb
full path to MS Access database file (extension “.mdb” or “.accdb”) or MS Excel file (extension “.xls” or “.xlsx”).
- excludeSystemTables
if TRUE (default), system tables are excluded from the table list, else included.
- namesOnly
if TRUE, only table names are returned. Default: TRUE
- use2007Driver
if TRUE the functions odbcConnectAccess2007 and odbcConnectExcel2007 are used instead of odbcConnectAccess and odbcConnectExcel, respectively
- dbg
if TRUE, debug messages are shown
Value
data.frame with columns TABLE_CAT, TABLE_SCHEM,
TABLE_NAME, TABLE_TYPE, REMARKS, see sqlTables of RODBC package.
Examples
if (FALSE) {
## Get names of tables in the example database
## (only on Windows)
if (.Platform$OS.type == "windows") {
tnames <- hsTables(xmdb(), namesOnly = TRUE)
## Exclude system tables by filtering for table names
## not starting with '^MSys'
tNonSys <- grep("^MSys", tnames, invert = TRUE, value = TRUE)
## Print the names of the non-system tables.
cat(paste(tNonSys, "\n"))
}
## Ouput:
# tbl_Hyd
# tbl_Qua
# ...
}