QUERY {birdscanR} | R Documentation |
Query 'SQL' database
Description
Run an 'SQL' query on an already connected database
Usage
QUERY(dbConnection, dbDriverChar, query, as.is = FALSE)
Arguments
dbConnection |
a valid database connection |
dbDriverChar |
the name of the driver |
query |
an 'SQL' string with your query |
as.is |
If TRUE, leaves data as it is |
Value
the result of the query
Author(s)
Fabian Hertner, fabian.hertner@swiss-birdradar.com; Birgen Haest, birgen.haest@vogelwarte.ch
Examples
## Not run:
# Set server and database settings
# ===========================================================================
dbServer = "MACHINE\\SERVERNAME" # Set the name of your SQL server
dbName = "db_Name" # Set the name of your database
dbDriverChar = "SQL Server" # Set either "SQL Server" or "PostgreSQL"
# Open the connection with the database
# ===========================================================================
dsn = paste0("driver=", dbDriverChar, ";server=", dbServer,
";database=", dbName,
";uid=", rstudioapi::askForPassword("Database user"),
";pwd=", rstudioapi::askForPassword("Database password"))
dbConnection = RODBC::odbcDriverConnect(dsn)
QUERY(dbConnection = dbConnection,
dbDriverChar = dbDriverChar,
query = "Select * From collection order by row asc")
## End(Not run)
[Package birdscanR version 0.3.0 Index]