Skip to content

Instantly share code, notes, and snippets.

@bradlindblad
Last active March 4, 2019 19:44
Show Gist options
  • Save bradlindblad/d40333fedf8755f943ff300fbb0d5844 to your computer and use it in GitHub Desktop.
Save bradlindblad/d40333fedf8755f943ff300fbb0d5844 to your computer and use it in GitHub Desktop.
get_customers.R
get_customers <- function() {
#' Pull most recent customer data from G23 - datascience.agc_Customers
require(odbc)
con <- dbConnect(odbc(),
Driver = "SQL Server",
Server = "datas",
Database = "dataserver",
UID = "user",
PWD = rstudioapi::askForSecret("password"),
Port = 6969)
query1 <- "SELECT * FROM datas.dbo.Customers"
z <- odbc::dbGetQuery(con, query1)
return(z)
odbc::dbDisconnect(con)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment