This post states the steps to connect R studio with SQL Server, so that we can directly access tables and can do analysis on data stored in SQL Server.
System Related Settings
1. Go to Control panel of your system.
2. Click on Administrative tools
3. Select User dsn -> click on “add” -> “Sql server”
4. Give the details as:
5. Click on Next :
Open R studio
1. Install and load RODBC package:
2. Execute below Codes to connect R with SQL Server:
myconn <-odbcConnect(“Roma”, uid=”*******”, pwd=”*******”) pundat <- sqlQuery(myconn, “select top 2 * from Table_Trans_Currentweek”)
3. While exit, close the connection as: