This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| df <- data.frame(x = c("1.3", "2x")) | |
| # dbplyr::test_register_src( | |
| # "mssql", | |
| # odbc::dbConnect( | |
| # odbc::odbc(), Driver = "ODBC Driver 17 for SQL Server", | |
| # Server = "<server>", UID = "<uid>", PWD = "<password>") | |
| # ) | |
| con <- src_test("mssql") | |
| db <- copy_to(con, df, "##test") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(dbplyr) | |
| library(dplyr, warn.conflicts = FALSE) | |
| df <- data.frame(x = c("1.3", "2x")) | |
| # both a 'float' (non-integer) and an 'invalid' number in the column | |
| con <- DBI::dbConnect(...) # connection to a MSSQL database | |
| db <- copy_to(con, df, "##test") | |
| db %>% mutate( | |
| float = TRY_CAST(x %as% sql("FLOAT")), |