Edit

Share via


What is SQL Server Language Extensions?

Applies to: SQL Server 2019 (15.x) and later versions

Language Extensions is a feature of SQL Server used for executing external code. The relational data can be used in the external code using the extensibility framework. In SQL Server 2019 (15.x) and later versions, Java, C#, Python, and R runtimes are supported.

Note

For executing Python or R in SQL Server, see the Machine Learning Services with Python and R documentation. With SQL Server 2019 (15.x) and later versions, you can use a custom Python and R runtime with Language Extensions. For more information, see Install a Python custom runtime for SQL Server and Install an R custom runtime for SQL Server.

What you can do with Language Extensions

Language Extensions uses the extensibility framework for executing external code. Code execution is isolated from the core engine processes, but fully integrated with SQL Server query execution. You can execute code at the data's source, eliminating the need to pull data across the network.

External languages are defined with CREATE EXTERNAL LANGUAGE. The system stored procedure sp_execute_external_script is used as the interface for executing the code.

Language Extensions provides multiple advantages:

  • Data security. Bringing external language execution closer to the source of data avoids insecure data movement.

  • Speed. Databases are optimized for set-based operations.

  • Ease of deployment and integration. SQL Server is the central point of operations for many other data management tasks and applications. By using data in the database, you ensure that the data used by the language extension is consistent and up-to-date.

The native Common Language Runtime Integration allows you to implement some of the functionalities of SQL Server with .NET languages. For a discussion of the differences between SQL CLR and SQL language extensions, see Compare SQL Server Language Extensions to SQL CLR.

For more information about security with the extensibility framework, see Security architecture for the extensibility framework in SQL Server Machine Learning Services.