'You must access this provider through a linked server.'
I'm running this batch file remotely from the database server which is also remote. I'm trying to do an export which shouldn't have a need for the linked server. When I run the query in SSMS it exports fine, but when it's executed from the batch, it gives me the error message below. I think it may be because theyre on 2 different accounts.
Here's my batch code:
SQLCMD -S dbserver -E -d dbname-i \\Network\fldr\rpt\test\script.sql
PAUSE
Here is my SQL script:
SET ANSI_NULLS ON
GO
SET ANSI_WARNINGS ON
GO
SET QUOTED_IDENTIFIER ON
GO
PRINT 'exporting data...'
INSERT INTO OPENROWSET(
'Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;
Database=\\Network\fldr\rpt\test\testdata.xls;',
'SELECT * FROM [Sheet1$]') SELECT * FROM [dbo].view_test ORDER BY [Col4]
Error message in cmd: