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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

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

Aged Yak Warrior

530 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

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?

Posting Yak Master

160 Posts

Posted - 02/14/2013 :  18:19:20  Show Profile  Reply with Quote

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  
 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.02 seconds. Powered By: Snitz Forums 2000