11

I'm a .NET developer and new to mac (m1 pro). I use docker and pull the azure-sql-edge image. When I try to create a table with a geometry column or insert a value in the geometry type column that was generated by code first solution, I encounter the error below:

Common Language Runtime(CLR) is not enabled on this instance.

I tried to enable CLR by running exec sp_configure 'clr enabled',1, but encountered the error below:

The specified option 'clr enabled' is not supported by this edition of SQL Server and cannot be changed using sp_configure.

What to do? Please help me.

Solomon Rutzky
  • 46,688
  • 9
  • 128
  • 171
Abbas Behjatnia
  • 131
  • 1
  • 5

3 Answers3

8

CLR-based functionality — whether it be the instance-level "CLR Integration" option (which enables custom / user-created assemblies); data types geometry, geography, and hierarchyid; built-in functions such as COMPRESS, DECOMPRESS, FORMAT, AT TIMEZONE; or a few other features — are not available in Azure SQL Edge. There is no way around this (at least not at this time). If any of this functionality is required, then using Azure SQL Edge as a platform is not an option. (Yeah, it kinda sucks, but that's how it goes.)

P.S. The CLR-based data types and built-in functions are not controlled via sp_configure 'clr enabled'. If they are available on the platform, then they cannot be disabled (outside of enabling fiber-mode / lightweight pooling, which is not something anyone should do).

Solomon Rutzky
  • 46,688
  • 9
  • 128
  • 171
0

A workaround for Mac Silicon users:

  1. Install Docker Desktop if you haven't already
  2. In settings -> general -> "Use Virtualization framework" should be checked
  3. In settings -> features in development -> "Use Rosetta for x86/amd64 emulation on Apple Silicon" should be checked
  4. Instead of using the Azure-SQL-Edge image, use the SQL2019 image. ie. Run from terminal: docker run --name SQLExpress2019 -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=yourStrong(!)Password" -e "MSSQL_PID=Express" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2019-latest

NOTES:

  • Change password to something else.
  • Also could possibly try 2022 instead of 2019.
  • Express Edition is optional.
  • Docker will display an emulation warning, but it still works
dalcam
  • 1,027
  • 11
  • 28
0

As suggested by others in the SQL2019 image CLR is supported

  1. Pull Command : docker pull mcr.microsoft.com/mssql/server:2019-latest
  2. docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=1' -e 'MSSQL_SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 --name azuresqledge -d mcr.microsoft.com/mssql/server:2019-latest

If this run command doesn't work(it definitely should though) then:

Docker website -> Search 'Azure SQL Edge' -> 'Azure SQL Edge' official from Microsoft -> Here you will find the run command.

Copy the command and make a change in the command i.e towards the end 'mcr.microsoft......' must be mentioned, replace it with 'mcr.microsoft.com/mssql/server:2019-latest'