run_sql | R Documentation |
Execute native SQL code saved in the script on the database. Will execute one statement per script. If the script contains more than one statement, will execute the first statement (e.g. if the script contains drop table xxx; create table xxx;
, only the DROP TABLE statement will be executed). Handles the presence of SQL variable declarations and comments (in /* */
and --
).
run_sql(script, conn = con, return_output = F)
script |
path to the SQL script |
conn |
connection object created using |
return_output |
set to TRUE if the script is expected to return an output from a SELECT statement. |
## Not run:
con <- nhsbsaR::con_nhsbsa(database = "DALP")
# E.g. a create table statement
run_sql("INTXXX_BASE_TABLE.sql")
# E.g. a select statement
df <- run_sql("INTXXX_SUMMARY_DATA.sql", return_output = T)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.