Run OSQL on systems which do not have Sql Server i

2019-08-29 07:12发布

问题:

I have a batch file which runs an oSQL command (below).

oSQL -U devUID -P testPwd -S testServer -d testDb  -Q "EXEC [dbo].[sprocTEST]" 

When I run this batch file on systems which do not have sqlserver installed, it throws an error.

"odbc driver manager data source name not found and no default driver specified osql"

NOTE: Apart from the batch file I also copied - osql.exe , osql.rll

Does any one know how to resolve the odbc driver error?

Help much appreciated.

回答1:

You don't have the rights to redistribute osql.exe nor osql.rll, so you cannot copy them. The computer must install the SQL Server client tools from a valid distribution source, or you're breaking the law. The ODBC drivers are installed by MDAC.