Assume, you have configured all Settings, as requested in Setup SQL Machine Learing Services / R-Services. But still you are not able to run a TSQL Script like this one:

.. even not as sysadmin!

Errors arise like:

  • Msg 39012, Level 16, State 1, Line 8
    Unable to communicate with the runtime for 'R' script. Please check the requirements of 'R' runtime.
  • Msg 11536, Level 16, State 1, Line 8
    EXECUTE statement failed because its WITH RESULT SETS clause specified 1 result set(s), but the statement only sent 0 result set(s) at run time.
  • Msg 39021, Level 16, State 1, Line 30
    Unable to launch runtime for 'R' script. Please check the configuration of the 'R' runtime.
  • Msg 39019, Level 16, State 1, Line 30
    An external script error occurred: Unable to launch the runtime. ErrorCode 0x80070490: 1168(Element not found.).

Many Troubleshooing help Articles pointing to checking the Setup, the Config (as mentioned in the above Link), recreate rlauncher (rlauncher.config) and so on. Most of these are good points but often lead not to the solution.

When the TSQL R-Script is executed, nothing really happens, except the Error still is there.
So, it seems, that the main cause is permission.

If set the Lauchpad Service to the same Service Account as the SQL Server Service and the SQL Server Agent Service, solved in many Server environments the issue. The SQL Server Service Account is typically correct configured with the necessary User-Rights. So, the Launchpad Service will start and SQL Server can access the Launchpad Runtime to execute the Script correctly!