Monday, June 27, 2016

Setup and Configuer R Services in SQL 2016

SQL Server R Services is designed to help you complete data science tasks.  scale analysis to billions of records without additional hardware, boost performance, and avoid unnecessary data movements.

Now you can put your R code into production without having to re-write it in another language. It also makes it easy to use R for statistical computations that might be difficult to implement using SQL. At the same time, you can leverage the power of SQL Server to achieve maximum performance, using features such as the in-memory database engine and column store indexes.

Here you will find detailed steps how you can install and configure R services and run your first code .

  1. launch the Setup of SQL Server
  2. Go to Installation clickable link in the left pane
  3. Click at the first link the right pane as below screen shoot shows


 4. on the feature selection page select these options
  •  Database Engine Services
  •  R Services (In-Database
5. On the page, Consent to Install Microsoft R Open, click Accept.
6. if you are using a server doesn't connect to internet you will be asked to provide the location of R   packages you can download from here ( https://go.microsoft.com/fwlink/?LinkId=761266&lcid=1033  https://go.microsoft.com/fwlink/?LinkId=735051&lcid=1033 )
7. point to the location of the files downloaded in step 6 and then press next
8. installation progress started
9. you should now successfully installed R service


10. connect to the instance where the R service installed
11. Run the following T-SQL Code to enable
Exec sp_configure  'external scripts enabled', 1 
Reconfigure  with  override

12. Restart the SQL Server Service (DB Engine)
13. the instance is ready to run the first R code
exec sp_execute_external_script  @language =N'R',   
@script=N'OutputDataSet<-inputdataset br="" nbsp="">@input_data_1 =N'select 1 as hello'   
with result sets (([hello] int not null));   
go
  

Enjoy :) this is the output of you first R' code