SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Error running script from batch file
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Vack
Constraint Violating Yak Guru

USA
495 Posts

Posted - 02/14/2013 :  10:44:57  Show Profile  Reply with Quote
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 - 02/14/2013 :  18:19:20  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000