1
votes

when I try to run the sqlcmd command in the command line, I get the following error message:

Sqlcmd: Error: Microsoft ODBC Driver 11 for SQL Server : Specified driver could not be loaded due to system error 193: (ODBC Driver 11 for SQL Server, C:\Windows\system32\msodbcsql11.dll)

I checked "C:\Windows\system32\" directory and I can see that the the dll is located correctly:

DLL is located in the directory

I also double checked that "Microsoft ODBC Driver 11 for SQL Server" is installed (version 12.0.2000.8).

OS: Windows Server 2012 R2 Standard

SQL Server Version: Microsoft SQL Server 2014 - 12.0.2000.8 (X64) Feb 20 2014 20:04:26 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows NT 6.3 (Build 9600: )

Any ideas why I cannot run the command sqlcmd in the command line?

Thanks a lot in advance, Roman

1
Error 193 is ERROR_BAD_EXE_FORMAT. You typically get this when a 32-bit process attempts to load a 64-bit DLL or vice versa. Is the sqlcmd process you invoke 32-bit, by any chance? Try checking your PATH to see if there's anything funny in there. - Jeroen Mostert
Of course, ERROR_BAD_EXE_FORMAT could also simply mean that, well, the DLL is corrupt. Try verifying it against a checksum list (or simply reinstall). - Jeroen Mostert

1 Answers

0
votes

I downloaded Dependency Walker and realized that msodbcsql11.dll is really x86 instead of x64. I replaced the DLL and everything works fine.

Thanks for your help, Roman