How to Install Machine Learning Services in SQL Server
Key steps covered in the video:
Get the SQL Server 2017 installation media. In this walk through we will use the free developer edition that you can download here:
If you already have SQL Server 2017 installed, but don't have ML Services, you can simply add that feature to your existing installation during the installation wizard.
Start the installation. If you chose the free developer edition, make sure to s the custom installation so we can add Machine Learning Services to the install.
Start the installation wizard:
Complete each step in the wizard and be sure to select R and/or Python in the feature list:
You now have Machine Learning Services installed on SQL Server.
How to Enable Machine Learning Services in SQL Server
Machine Learning Services is not enabled after installation in order to provide full control to DB administrators. We need to enable it before executing any R or Python code.
Open SQL Server Management Studio and connect to your instance. (If you don't have SSMS, you can get the free download here:
Open a new query, paste this statement and execute:
EXEC sp_configure 'external scripts enabled', 1
RECONFIGURE WITH OVERRIDE
Now let's restart the SQL Server service and verify if the configuration was successful.
Open SQL Server Configuration manager. (You can also use SSMS or Windows Services Manager)
Right click on the instance you just configured and click restart.
Make sure both the "SQL Server" and the "SQL Server Launchpad" services are both running by clicking "Refresh" under the "Action" menu.
Open a new query in SSMS and add either of these hello world samples for Python or R:
If you see the Hello World printed in the output, you know configuration was successful. If you do not see Hello World print, visit the documentation for more details (
Here is a simple example of passing data from SQL to Python.
EXEC sp_execute_external_script @language =N'Python',
@script = N'
OutputDataSet = InputDataSet + 4;
@input_data_1 =N'SELECT 1 AS Col1';
Visit our documentation
, or stay tuned for our next blog post where we will discuss more details about input parameters and other basics in executing R/Python in SQL Server.
Congratulations, you are now ready to use ML Services and execute R and Python code! Check out this
that covers the basics of the syntax, parameters, and data types. We want to hear your feedback, please comment below to ask questions and tell us what you want to learn next!