
sqlFetch(channel, sqtable, ..., colnames = FALSE, rownames = TRUE)
sqlFetchMore(channel, ..., colnames = FALSE, rownames = TRUE)
odbcConnect
.sqlQuery
or sqlGetResults
. See
‘Details’.sqlSave(colnames = TRUE)
was used.)rownames
) in the table? If character, the column name to
retrieve them from.sqlQuery
).
sqlFetch
by default retrieves the the entire contents of the table
sqtable
. Rownames and column names are restored as indicated
(assuming that they have been placed in the table by the corresponding
arguments to sqlSave
). Alternatively, sqlFetch
can fetch the first max
rows, in
which case sqlFetchMore
will retrieve further result rows,
provided there has been no other ODBC query on that channel in the
meantime.
These functions try to cope with the peculiar way the Excel ODBC
driver handles table names, and to quote Access table names which
contain spaces. Dotted table names, e.g. myschema.mytable
, are
allowed on systems that support them, unless the connection was opened
with interpretDot = FALSE
.
Useful additional parameters to pass to sqlQuery
or
sqlGetResults
include
sqlSave
, sqlQuery
,
odbcConnect
, odbcGetInfo
## Not run:
# channel <- odbcConnect("test")
# sqlSave(channel, USArrests)
# sqlFetch(channel, "USArrests") # get the lot
# sqlFetch(channel, "USArrests", max = 20, rows_at_time = 10)
# sqlFetchMore(channel, max = 20)
# sqlFetchMore(channel) # get the rest
# sqlDrop(channel, "USArrests")
# close(channel)
# ## End(Not run)
Run the code above in your browser using DataLab