sql server - Batch file that runs sql script getting error Ad hoc access to OLE DB provider 'Microsoft.ACE.OLEDB.12.0' has been denied.' -
'You have to access this provider through a linked server.'
I am running this batch file from the remote server, which is remote to the database server, I am trying to export an extraneous server that does not need a linked server. When I run a query in SSMS, it exports fine, but when it is executed with a batch, I get an error message below. I think it could be because they are in 2 different accounts.
This is my batch code:
SQLCMD -S dbserver -E -d dbname-i \\ network \ fldr \ rpt \ test \ script.sql Pause here is my SQL script:
oN GO set GO set ANSI_WARNINGS set ANSI_NULLS to export print on 'data during QUOTED_IDENTIFIER ... join' Opanoarojesti ( 'Microsoft. ACE. Oelidibi .12.0', 'Excel 12.0; database = \\ network \ Fardiar \ rpt \ Test \ Testdetakcls;', 'Select * fROM [Sheet1 $]') error CMD message:
I solved the problem When running the batch file on my work pc, it uses separate accounts for SQL Server - my Active Directory account credentials, an account that was not present in the SSMS. I created the account and it worked.
The steps I took before (whatever was necessary) are as follows:
1) Run this code
USE [Master] Go Excise master dbo Sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0 ',' Aloeine Process', 1GO ECEC Master dbo. sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0 ', N'DynamicParameters', 1 GO 2) DWORD "disallowAdHocProcess to edit the registry on the value of" 0 "" adding location: [HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Microsoft SQL server \ MSSQL10.SQLADV \ provider \ Microsoft.ACE.OLEDB.12.0] "disallowAdHocProcess" = DWORD: 00000000
3) of this article and use ProcMon The program was being denied access to me to find the Temp path.
Comments
Post a Comment