sqlcmd -?
via PowerShell should return version information and usage guidelines, as in:
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\Users\xxx> sqlcmd -?
Microsoft (R) SQL Server Command Line Tool
Version 15.0.4123.1 NT
Copyright (C) 2019 Microsoft Corporation. All rights reserved.
usage: Sqlcmd [-U login id] [-P password]
[-S server] [-H hostname] [-E trusted connection]
[-N Encrypt Connection][-C Trust Server Certificate]
[-d use database name] [-l login timeout] [-t query timeout]
[-h headers] [-s colseparator] [-w screen width]
[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]
[-c cmdend] [-L[c] list servers[clean output]]
[-q "cmdline query"] [-Q "cmdline query" and exit]
[-m errorlevel] [-V severitylevel] [-W remove trailing spaces]
[-u unicode output] [-r[0|1] msgs to stderr]
[-i inputfile] [-o outputfile] [-z new password]
[-f | i:[,o:]] [-Z new password and exit]
[-k[1|2] remove[replace] control characters]
[-y variable length type display width]
[-Y fixed length type display width]
[-p[1] print statistics[colon format]]
[-R use client regional setting]
[-K application intent]
[-M multisubnet failover]
[-b On error batch abort]
[-v var = "value"...] [-A dedicated admin connection]
[-X[1] disable commands, startup script, environment variables [and exit]]
[-x disable variable substitution]
[-j Print raw error messages]
[-g enable column encryption]
[-G use Azure Active Directory for authentication]
[-? show syntax summary]
PS C:\Users\xxx>
I have confirmed this using PowerShell on Windows Server 2019. I would suggest trying sqlcmd.exe -?
via the regular command-line, cmd.exe
.
where sqlcmd
return? It should just be an executable under your SQL Server client installation. You don't need any additional modules to run this, although installing those modules could be giving you access to additional powershell cmdletswhere where
return? It should typically showC:\Windows\System32\where.exe
where sqlcmd
returns nothing? Very strange.