Start the sqlcmd Utility
Applies To: SQL Server 2016
On the Start menu click Run. In the Open box type cmd, and then click OK to open a Command Prompt window. (If you have not connected to this instance of the SQL Server Database Engine before, you may have to configure SQL Server to accept connections.)
At the command prompt, type sqlcmd.
You now have a trusted connection to the default instance of SQL Server that is running on your computer.
1> is the sqlcmd prompt that specifies the line number. Each time you press ENTER, the number increases by one.
To end the sqlcmd session, type EXIT at the sqlcmd prompt.
Open a Command Prompt window, and type sqlcmd -SmyServer\instanceName. Replace myServer\instanceName with the name of the computer and the instance of SQL Server that you want to connect to.
The sqlcmd prompt (1>) indicates that you are connected to the specified instance of SQL Server.
Entered Transact-SQL statements are stored in a buffer. They are executed as a batch when the GO command is encountered.