Determining the version of .NET Framework inside SQL Server

Posted: (EET/GMT+2)

 

SQL Server allows you to include .NET code using the SQLCLR feature. But, how do you know which .NET Framework version is installed into SQL Server?

There's a system view called "sys.dm_clr_properties" that conveniently returns this information:

SELECT * FROM sys.dm_clr_properties;

For example in SQL Server 2016, this returns three rows of data, like this:

name	value
directory	C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
version	v4.0.30319
state	CLR is initialized

Happy SQL'ing!