1

I executed this to check to see if I have write permissions on a folder and it fails (returns -1). I am a system admin and SQL admin. I have full access to this directory but the R Script says I do not. If I change the mode of the script to check for read or execute permissions, it succeeds (returns 0). What else can I check to fix this?

EXECUTE sp_execute_external_script
       @language = N'R'
      ,@script = N'OutputDataSet <- data.frame(file.access("C:/Program Files/Microsoft SQL Server/MSSQL13.MSSQLSERVER/R_SERVICES/library/", 2));'
WITH RESULT SETS (([DefaultLibraryName] VARCHAR(MAX) NOT NULL));
GO
1

I think you 'might' need to grant the proper authority on that folder to the Windows group SQLRUserGroup.

I have a test SQL Server instance where R-Services is installed. I took your script and changed the directory to be C:/Scripts (just as a test).

EXECUTE sp_execute_external_script
       @language = N'R'
      ,@script = N'OutputDataSet <- data.frame(file.access("C:/scripts/", 2));'
WITH RESULT SETS (([DefaultLibraryName] VARCHAR(MAX) NOT NULL));
GO

I got the same -1 return code as you.

I then granted FULL access against C:/Scripts to the Windows group SQLRUserGroup and ran the same script code. It executed successfully with a zero (0) being returned.

3
  • How did you grant permissions to the GROUP? It looks like you have to do it for each and every User within the Group Sep 10 '18 at 16:23
  • @PabloBoswell - When I installed R-Services on my computer, a new Windows group call SQLRUserGroup was automatically created. 20 iindividual Windows user accounts MSSQLSERVER00 thru MSSQLSERVER20 was also created - each of which is a member of the SQLRUserGroup. I merely granted the Windows group with the appropriate permissions. Sep 10 '18 at 16:51
  • Do you know if there is a way to grant this group permissions to shared/network drives? Sep 10 '18 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.