0

The Environment:

The Problem: I am trying to run the sqlcmd command in Powershell and Command Prompt. When I run it in PowerShell such as sqlcmd -? nothing happens, it just returns to c:\Windows\system32\. When I run sqlcmd -? in Command Prompt it throws the following error:

The application was unable to start correctly (0xc000007b). Click OK to close the application.

I am not sure why I am getting this error. This is nothing in the system logs. I did find this fix on here but I have Visual C++ Redistributables from 2005, 2008, 2012, 2013, 2015-2019 for the software I have running on the server. Many of those running both x86 an x64 versions.

The Question: What is causing the 0xc000007b error from allowing me to run my sqlcmd command? And if it is an issue with the Visual C++ version, do I need all the previous year versions or can I remove all of those and just use the 2015-2019 versions (x64 & x86) as they are the latest? And to fix this issue would I do a repair of those Redistributables or uninstall or reinstall?

UPDATE Uninstalled the CMDLINE tools for 32 bit and installed 64bit tools and still can't get sqlcmd -? to show anything. If I invoke the .exe and use the commands nothing happens. Does anyone have any other ideas?

JukEboX
  • 395
  • 2
  • 4
  • 21
  • 1
    Does the PATH variable contain the sqlcmd folder? – harrymc Sep 16 '21 at 13:33
  • 1
    My (high level) guess is that your setup is trying to intermix 32 and 64 bit components (probably at the ODBC layer). You likely are running a 32bit .exe with a 64bit ODBC driver or visa versa. – Señor CMasMas Sep 16 '21 at 13:37
  • @harrymc Yes the the sqlserver Folder is in the PATH and PSModulePath for the server Environments. – JukEboX Sep 20 '21 at 12:10
  • @SeñorCMasMas Yes I removed the x86 SQLCMD tools and reinstalled the x64 tools while the ODBC is still x64 rand still get nothing in return when I do 'sqlcmd -?' – JukEboX Sep 20 '21 at 12:11
  • 1
    Try looking for missing dependencies using [Dependencies](https://github.com/lucasg/Dependencies) for `sqlcmd.exe`. – harrymc Sep 20 '21 at 12:34
  • @harrymc it is saying BatchParser.dll is not on the disk even though it is in the same folder that SQLCMD is. Also it says ODBC32.dll has missing imports. I am confused as to why it says it's not on the disk. Also I have the 64 bit version installed by is it referenceing system 32 or the ODBC for 32 bit? – JukEboX Sep 21 '21 at 17:09
  • 1
    The reason could be a mixture of 32- and 64-bit software. See [this post](https://superuser.com/questions/358434/how-to-check-if-a-binary-is-32-or-64-bit-on-windows). – harrymc Sep 21 '21 at 17:18
  • 1
    Also, file in same folder has priority over the PATH. – harrymc Sep 21 '21 at 17:37
  • @harrymc according to that answer the SQLCMD is PE d† meaning 64 bit. – JukEboX Sep 23 '21 at 11:26
  • And what is `BatchParser.dll`? – harrymc Sep 23 '21 at 12:52
  • @harrymc not sure but when I ran dependencies it showed as an issue. – JukEboX Oct 07 '21 at 11:46
  • If SQLCMD is 64-bit but `BatchParser.dll` is 32-bit then it's unusable for SQLCMD. – harrymc Oct 07 '21 at 13:26
  • @harrymc how can you tell the difference? – JukEboX Nov 11 '21 at 15:38
  • [How to Check if a Program (.EXE or .DLL) is 32-bit or 64-bit](https://www.winhelponline.com/blog/find-out-if-a-program-exe-file-is-32-bit-or-64-bit/). – harrymc Nov 11 '21 at 16:00
  • @harrymc should I do a full uninstall of everything SQL and reinstall? – JukEboX Mar 10 '22 at 18:11
  • 1
    Yes, you could. Ensure that the installation folders were fully cleaned out, and that the installation you do all softwares are of the same bitness. – harrymc Mar 10 '22 at 20:45

0 Answers0