views:

32

answers:

1

I have a Windows 2008 x64 server and with SQL Server 2008 x64 installed. osql.exe under SQL Server directory could list instances with -L. I copied osql.exe+osql.rll from another SQL Server 2005 x86 and '.\osql.exe -L' returns error like "[ODBC Driver Manager] Data source name not found and no default driver specified".

After check registry 'HKLM\SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI', the 'SQL Server' and 'SQL Server Native Client 10.0' are ok and related dll files are ok. I also checked MDAC version, it's 6.0.6002.18005. Did i miss anything?

One interesting thing is osql.exe from SQL Server 2000 ran well to list instances on the server. And osql.rll isn't necessary, the osql.exe only needs msvcr71.dll.

What can i do to make osql.exe(from sql 2005) to run on the server? And are there any difference between those 2 osql.exe(sql 2005, sql 2000)?

A: 

As DaveShaw said, you should probably be using SQLCMD.EXE instead... fortunately the syntax is quite comparable to the old OSQL.EXE, so the transition shouldn't be hard.

You can download SQLCMD (a/k/a the Microsoft SQL Server 2005 Command Line Query Utility) from the latest Feature Pack for SQL Server 2005 page. Install the appropriate SQLCMD and the SQL Server Native Client (also on the same page) and you can run the commands from any client system on the network, x86 or x64 no matter.

ewall