Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Error running script from batch file

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2013-02-14 : 10:44:57
I have a query that is using a linked server to an Excel worksheet. When I run the query from Management studio it works fine. When I try to run it using osql I get the following error.

Building the Linked Excel Connection...
1> 2> 3> 4> 5> 6> 7> 8> 9> 10>
Logging into the Linked Excel Connection...
Msg 7399, Level 16, State 1, Server SQLSERVER1, Line 10
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server
"PriceDataBase" reported an error. The provider did not give any
information about the error.
Msg 7303, Level 16, State 1, Server SQLSERVER1, Line 10
Cannot initialize the data source object of OLE DB provider
"Microsoft.ACE.OLEDB.12.0" for linked server "PriceDataBase

Here is what is in my batch file to kick off the script:
osql -U sa -P password1 -S SQLSERVER1 -i RetrieveFromES.sql -o RetrieveFromES_log.txt
pause

When logged in as administrator I can run the batch file with no errors.

One option I was thinking of. Is there a way to have a user get into Management studio to only run Queries? Kind of like SQL 2000 and Query Analyzer?

srimami
Posting Yak Master

160 Posts

Posted - 2013-02-14 : 18:19:20
Question:

Is the Sql you are running on SSMS is same as RetrieveFromES.sql
Are you running this script under the same network domain? If not, this will not work.

And yes, we do have Sql Developer/Toad to connect and run queries against SSMS.
Go to Top of Page
   

- Advertisement -