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)