您的位置:首页 > 数据库

how to use sqlserver2008 to search in files

2017-07-13 11:03 537 查看
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]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: