'엑셀조회'에 해당하는 글 1건

SELECT a.*

FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','excel 8.0;database=c:\book1.xls;admin;', Sheet1$) 

AS a

GO


-- 아래의 그림과 같이 확인할 수 있다.

-- 단, 엑셀파일이 OPEN 상태에서는 


Msg 7399, Level 16, State 1, Line 1

The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" reported an error. The provider did not give any information about the error.

Msg 7303, Level 16, State 1, Line 1

Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".


-- 위와 같은 에러메세지가 나오니 엑셀파일을 닫고 테스트 해야함.






-- 다음 예에서는 모든 구성 옵션을 설정하고 나열하는 방법을 보여 줍니다. 먼저 show advanced option을 1로 설정하면 고급 구성 옵션이 표시됩니다. 

-- 이 옵션을 변경한 다음 매개 변수 없이 sp_configure를 실행하면 모든 구성 옵션이 표시됩니다.

sp_configure 'show advanced options', 1  

RECONFIGURE  

GO  


--------------------------------------------------------------------------------------------------------------------------------------

--메시지 15281, 수준 16, 상태 1, 줄 1

--구성 요소 'Ad Hoc Distributed Queries'이(가) SQL Server 보안 구성의 일부로 해제되었으므로 

--이 구성 요소의 문 'OpenRowset/OpenDatasource'에 대한 액세스가 차단되었습니다.

-- 시스템 관리자는 sp_configure를 사용하여 'Ad Hoc Distributed Queries'의 사용을 활성화할 수 있습니다. 

-- 'Ad Hoc Distributed Queries' 활성화 방법은 SQL Server 온라인 설명서의 "노출 영역 구성"을 참조하십시오.

 

[ 해결방법 ]

 

sp_configure 'show advanced options',1;

go

reconfigure ; 

go

sp_configure  'Ad Hoc Distributed Queries', 1

go 

reconfigure ;

go

[출처] MS-SQL OPENROWSET 사용하기|작성자 불가사리

--------------------------------------------------------------------------------------------------------------------------------------

 







WRITTEN BY
테네시왈츠
항상 겸손하게 항상 새롭게 항상 진실하게

,