Having a connection to Microsoft SQL Server in the command prompt provides you with an easily disposable window that you can use to query a database without resorting to the SQL Server Management Studio. Personally, I like to have it tucked into a little corner of my screen where It can be easily accessed; for tasks such as checking if i have a connection to the server, listing tables in a database and running simple queries. Lets see how we can get a connection to SQL Server up and running in a VS2012 DOS Box.
- Open a visual studio command prompt dos box.
- Type CD/ at the command prompt.
- At the command line enter sqlcmd -S [SERVERNAME|IP] -U [USERNAME] -P [PASSWORD]
*NB: The parameters in  should be replaced with the actual authentication details of the server that you want to connect to. Each command should be followed by the GO directive in order for them to be executed.
That’s how its done, see you next time.