RunSqlFile: A helper function that loads an SQL script, updates the...

RunSqlFileR Documentation

A helper function that loads an SQL script, updates the variables in the script to values provide and formats the resulting data by renames columns to common R style.

Description

A helper function that loads an SQL script, updates the variables in the script to values provide and formats the resulting data by renames columns to common R style.

Usage

RunSqlFile(db.conn, file.name, variables = NA)

Arguments

db.conn

An ODBC connection to the ODBC database

file.name

A file name that the SQL script is saved to

variables

An R list of variables, variable names in the list are matched to ones with the same name in a format like %VARIABLENAME% (eg list(runid = 1) will replace %RUNID% in the SQL with 1)

Value

A data frame with query results

EXCEPTIONS

If a variable type is found that the function can't handle (e.g. a vector), the script will throw an exception.


PSC-CoTC/AnnualReport documentation built on Feb. 15, 2025, 8:34 p.m.