odez213
odez213

Reputation: 723

Windows 7 OSQL Batch

I have just got a new work PC from running Windows 7. I have installed SQL Server 2008 and I have a batch file that runs an OSQL command as follow:

osql -S MyServer -E -d MSDB -n -o results.txt -i MyScript.sql

For some reason it is giving me exception below:

Specified driver could not be loaded due to system error  126: The specified module could not be found. (SQL Server Native Client 10.0, C:\Windows\system32\sqlncli10.dll).

I am not sure what the issue is and I have even tried to run the batch file using 'Run as administrator'.

Upvotes: 0

Views: 698

Answers (1)

Aaron Bertrand
Aaron Bertrand

Reputation: 280510

OSQL is being deprecated; I would consider converting your code to use sqlcmd or PowerShell. However if you're missing SQL native client you might consider adding it. You can download the sqlncli.msi file for your platform from this URL (more than halfway down the page).

Upvotes: 2

Related Questions