example:
select * from
OPENROWSET('MICROSOFT.JET.OLEDB.4.0'
,'Text;HDR=No;DATABASE=D:\Data\FullIdList'
,'select * from [b.txt]')
problem 1:
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.
solution :
--0 show sys.configurations, if the value of 'Ad Hoc Distributed Queries' is 0 ,go ahead
SELECT * FROM sys.configurations
ORDER BY name ;
--1. Use below script to enable to update the configurations:
sp_configure 'show advanced options',1
reconfigure
--2.Enable 'Ad Hoc Distributed Queries':
sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
problem 2:
solution :
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\TEXT]
select * from
OPENROWSET('MICROSOFT.JET.OLEDB.4.0'
,'Text;HDR=No;DATABASE=D:\Data\FullIdList'
,'select * from [b.txt]')
problem 1:
SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ad Hoc Distributed Queries' by using sp_configure. For more information about enabling 'Ad Hoc Distributed Queries', see "Surface Area Configuration" in SQL Server Books Online.
solution :
--0 show sys.configurations, if the value of 'Ad Hoc Distributed Queries' is 0 ,go ahead
SELECT * FROM sys.configurations
ORDER BY name ;
--1. Use below script to enable to update the configurations:
sp_configure 'show advanced options',1
reconfigure
--2.Enable 'Ad Hoc Distributed Queries':
sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
problem 2:
solution :
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\TEXT]