SQL Server 2008 OPENROWSET Release Permission Issued

I am using the 64-bit version of SQL Server 2008 for the 64-bit version of Windows Server 2008 Enterprise. I found that when I execute the following statement in SQL Server Management Studio, I need sysadmin permission. I use a statement to import data from Excel into a database table. My question is: am I concerned that the sysadmin permission is too large, any solutions to use a lower privileged permission to implement the same function?

select * from OPENROWSET('MICROSOFT.ACE.OLEDB.12.0', 'Excel 12.0;HDR=YES;DATABASE=C:\mytest1.xlsx',sheet1$) 
+4
source share
2 answers

From online books OPENROWSET (Transact-SQL)

User requires ADMINISTER BULK OPERATIONS permission.

And here is the entry for GRANTing. This is a server-level resolution, so yes, it's pretty high.

To try lower resolutions, you can create a standard connection to a connected server and add a login using

 EXEC sp_addlinkedsrvlogin 'LINKSERVERNAME', 'false', 'localuser', 'rmtuser', 'rmtpass' 

It does not seem to require any specific permissions, so if you have configured a linked server, it is impractical to configure it using a common linkedsrvlogin that maps to each local user. Configure specific locally-remote mappings to control local user access through the linked server on the remote server (using rmtuser login).

+4
source
 select * from OPENROWSET('MICROSOFT.ACE.OLEDB.12.0', 'Excel 12.0;HDR=YES;DATABASE=C:\mytest1.xlsx',sheet1$) 

Try with this

+1
source

Source: https://habr.com/ru/post/1336727/


All Articles