Hey! I think I'm stuck and would be glad if anyone could shed some light.
I have a DB in SQL Server and I want to import one of the tables to R. This table, call it 'A1' has 11M rows and ~15 columns, so it is heavy. I've tried multiple solutions to import it to R studio. None of them seems to work for me.
Here's what I've tried;
library(odbc)
con <- dbConnect(odbc(), driver = "SQL Server", server = "server_name", database="database_name")
A1 <- dbGetQuery(con, "SELECT * FROM A1")
which after ~2hours returned nothing.
I tried in SSMS, exporting 'A1' to a flat file and then import dataset from readr in R Studio. This seems to work just fine, but it inexplicably changes the data types. When I change them back in R Studio, it returns NAs. Also, some of the columns display wrong values. It is a mess and I don't get what is wrong here.
library(readr)
A1flatfile <- read_csv("C:/Users/user/db_folder/A1flatfile.txt")
View(A1)