How to write a large R dataframe into SQLServer?

r
sql
dataframe

#1

I am trying to save my prediction results (R dataframe) into SQLServer. I used RODBC’s functions such as sqlsave() and sqlcopy() to create a table in SQLServer from R. but I have no luck with them.

Could some help in this situation.

Thanks,
Praneeth


#2

Please let me know the data size


#3

Hi

Hope this helps and make changes for Sql server

Creating Tables in MySql

We can create tables in the MySql using the function dbWriteTable(). It overwrites the table if it already exists and takes a data frame as input.
Create the connection object to the database where we want to create the table.
mysqlconnection = dbConnect(MySQL(), user = ‘root’, password = ‘’, dbname = ‘sakila’,
host = ‘localhost’)

Use the R data frame “mtcars” to create the table in MySql.
All the rows of mtcars are taken inot MySql.
dbWriteTable(mysqlconnection, “mtcars”, mtcars[, ], overwrite = TRUE)

Thanks,
Tony