Get Started with SQL Server Machine Learning Services – Part 1


We know Humans learn from their past experiences. Mean while Machines follow Instructions given by Humans. But what if Human can train Machines to learn from the past data?. In simple, this is what Machine learning is !!!!. SQL Server has capabilities of Machine Learning. In this article, we will discuss about the capabilities of Machine Learning in SQL Server.

Machine Learning Services in SQL Server

In 2016, Microsoft introduced Machine Learning Services in SQL Server with R. Based on the market demand, Microsoft incorporated the language called Python in 2017. Let’s have a look how a machine learning is done outside the database.

We have to extract the required data from the applications and storing those data in some databases. Then those data are moved to Analytics server in which we do Data Transformations, Model Training and prepare Model. Once the Model is prepared, we send that to Separate Service in which Scoring is done. And finally we send the New Data to the scoring service and then send our predications back to the Applications.

Fig. 1 Machine Learning Outside the Database

SQL Server Machine Learning Services makes this process much simpler. We no need to transfer the data all over. All the Machine Learning process is done within the Database.

Fig.2 Machine Learning within SQL Server Database

How it Works

We are not running Python or R languages in SQL Server Engine. Then how the Data science languages are executed ???. To execute Python or R Language SQL Server uses Launchpad. The launchpad is able to launch satellite programs, that might be Python or R language and it is capable to get the data SQL Server without moving them outside.

Fig.3 Launch Pad in SQL Server to Execute Data Science Languages

Using Python with SQL Server

First lets understand what Python is,

  • Python is an Open Source Programming Language
  • Due to its flexibility, it is popular among the Data Scientists.
  • To gain additional functionalities additional libraries and packages can be added easily.

Using Python with SQL Server,

  • Data no longer needs to be exported or moved outside.
  • Its more simply the ability to run an scripts on our relational data.
  • Python supports to process larger amount of data.
  • Data remains inside of SQL Server’s security wrapper, which maintains monitoring and auditing compliance.
  • Representative samples no longer need to be taken and analyses can better process a full data set.
  • Script execution benefits from performance technologies, such as in-memory table and column store indexes.

Running Python Code

We can use the same SSMS or Azure Data Studio Query editor to write and execute our Python code in SQL Server. We can also save the scripts as stored procedures for other users to run


In this article, we have discussed What is Machine Learning and How it works in SQL Server. I hope this article will be base for many of us to kick start to explore Machine Learning in SQL Server. We will discuss more concepts in upcoming article series. Please share your feedback in the comment section.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Website Built with

Up ↑

%d bloggers like this: