Use ODBC sqlcmd flags and backwards compatibility
mainThe sqlcmd tool maintains backwards compatibility with the original ODBC sqlcmd.
- To view original ODBC flags (like
-q,-Q,-i,-o), usesqlcmd -?. - To run a command using these flags within the current context, use
sqlcmd -q "<query>". - If no current context is active, running
sqlcmdwithout parameters reverts to the original behavior: attempting an interactive session on the default local instance (port 1433) using trusted authentication.
sqlcmd -?
sqlcmd -q "SELECT @@version"