Sunday, November 8, 2015

What is SQL CLR or SQLCLR?

In order to understand what is SQLCLR, you need to know what the individual parts, Sequential Query Language (SQL) and Common Language Runtime (CLR) are.

Common Language Runtime is the programming that manages the execution of programs written in any of the supported languages such as C#, VB, Visual C++ etc to share common object orineted classes. Thiss is somewhat like Java Virtual Machine for programs run from Java. CLR is also called 'managed execution environment'. CLR is therefore related to .NET programming.

SQL is a language that is needed to run queries (post questions to) against SQL Server databases. It is not specific to Microsoft SQL Server. It can also be used with other databases like Oracle, Sybase, etc.
However Transact SQL (T-SQL) is the enhancement to add some progrmmability to SQL.
SQL Common Language Runtime (SQLCLR) is the combo technology (SQL Server and .NET) for hosting .NET common language runtime engine within SQL Server. In other words you can run managed code from within SQL Server.

Since T-SQL already adds to SQL the programming capability why does one need SQL CLR?

The reason I that there are certain useful class of programs that are just not handled by T-SQL, or make it much more complex and less secure. Of course there are more reasons why SQL CLR is needed. This is the reason for the development of SQL CLR. Also Microsoft made extensive integration of SQL Server with its massive .NET programming which makes it lot more flexible.

For, Creating a Visual C++ CLR Console Application in Visual Studio 2015 go here.

No comments: