How to insert data into a SQL Server table using R?

I need help writing a simple data string on a SQL server from R Language. (using RODBC or otherwise).

+2
source share
1 answer

You can write all data (all rows) using sqlSave(channel, data, rownames = FALSE) , where channel <- odbcDriverConnect("Driver={SQL Server};Server=AAA;Uid=BBB;Pwd=CCC;") . This will create a table called data in your database.

Then you can add an existing sqlQuery(channel, 'insert into table select * from data') table sqlQuery(channel, 'insert into table select * from data') .

+4
source

Source: https://habr.com/ru/post/969975/


All Articles