Learn R Programming

RODBC (version 1.0-2)

sqlTables: List Tables on an ODBC Database

Description

List the tables on an ODBC database.

Usage

sqlTables(channel, errors = FALSE, as.is = TRUE)

Arguments

channel
connection handle as returned by odbcConnect.
errors
if TRUE halt and display error, else return -1
as.is

Value

  • A data frame on success, or character/numeric on error depending on the errors parameter. (See sqlGetResults for further details.)

    The column names depend on the database, containing a column table_name in some mixture of cases (see the examples).

See Also

sqlGetResults

Examples

Run this code
library(RODBC)
channel <- odbcConnect("test", "", "") # userId and password
sqlTables(channel, "USArrests")
## MySQL example
##   Table_qualifer Table_owner Table_name Table_type     Remarks
##1                             usarrests      TABLE MySQL table
## Microsoft Access example
##      TABLE_CAT TABLE_SCHEM        TABLE_NAME   TABLE_TYPE REMARKS
##1 C:\bdr\test        <NA> MSysAccessObjects SYSTEM TABLE    <NA>
##2 C:\bdr\test        <NA>          MSysACEs SYSTEM TABLE    <NA>
##3 C:\bdr\test        <NA>       MSysObjects SYSTEM TABLE    <NA>
##4 C:\bdr\test        <NA>       MSysQueries SYSTEM TABLE    <NA>
##5 C:\bdr\test        <NA> MSysRelationships SYSTEM TABLE    <NA>
##6 C:\bdr\test        <NA>             hills        TABLE    <NA>
##7 C:\bdr\test        <NA>         USArrests        TABLE    <NA>
odbcClose(channel)

Run the code above in your browser using DataLab