I installed the “SQL Server 2016 Release Candidate” today to start playing around with Microsoft is calling “SQL Server R Services (In-Database)”. I think this is really going to change the way we do things at the office and it’s got me really excited.

You can download the Release Candidate from https://www.microsoft.com/en-us/evalcenter/evaluate-sql-server-2016.

I chose the CAB install which downloads two files, about 1.9GB. Running the executable then unpacks the setup files you will need for installation. Then, setup should run automatically. Microsoft has some good instructions at https://msdn.microsoft.com/en-us/library/mt696069.aspx.

The last part of their instructions is a test to make sure R is working.

exec sp_execute_external_script @language =N'R',
@input_data_1 =N'select 1 as hello'
with result sets (([hello] int not null));

The install actually adds a new instance of R running on the server, which for me is just my laptop.  A simple change to the code above helped me to find where the instance is.

exec sp_execute_external_script @language =N'R',
@script=N'OutputDataSet <- as.data.frame(R.home())'
with result sets (([R.home] sysname));

You can add more packages to this install quite easily. I’ve gone ahead and pinned this R instance to my taskbar. Run it as an admin and the installed packages are automatically available to SQL Server code. After installing the actuar package, just to test, I ran this in SSMS and it worked!

exec sp_execute_external_script  @language =N'R',
OutputDataSet <- as.data.frame(search())&#039; 
with result sets (([LoadedPackages] sysname));