sql-serverssmssqlcmdssms-17

Can't find sqlcmd.exe (SQL SERVER 2017)


I've run into a problem about sqlcmd,

In the computer there is SSMS 2017 and I can use SQLCMD MODE in SSMS 2017, but I can't call sqlcmd in command prompt,

"'sqlcmd.exe' is not Recognized as an Internal or External Command, Operable Program or Batch File"

and i couldn't find the SQLCMD.EXE in the whole computer.

Since i can use SQLCMD MODE in SSMS, Is this means, there must be a sqlcmd.exe in the computer or not?

Thank you very much,


Solution

  • Since i can use SQLCMD MODE in SSMS, Is this means, there must be a sqlcmd.exe in the computer or not?

    Apparently not. I just tested by running

    :!! powershell pause
    

    in SQLCMD mode in SSMS and examining the process tree in Sysinternals Process Explorer:

    enter image description here

    It looks like SSMS is using PowerShell's Invoke-SqlCmd which is a seperate SQLCMD-compatible interpreter.

    And SQLCMD is a seperate download since SSMS 18.0:

    The following tools are no longer installed with SSMS:
    OSQL.EXE
    DReplay.exe
    SQLdiag.exe
    SSBDiagnose.exe
    bcp.exe
    sqlcmd.exe
    

    Deprecated and removed features in 18.0