How to test SQL server connection?
To enter Transact-SQL statements, system procedures, and script files at the command prompt, use the sqlcmd Utility. You can enter it in Query Editor in SQLCMD mode, in a Windows script file or in an operating system (Cmd.exe) job.
Start the sqlcmd utility and connect to a default instance of SQL Server
- Go to the command prompt window (Run→cmd)
- Enter sqlcmd and press enter.
- 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.
Start the sqlcmd utility and connect to a named instance of SQL Server
- Open a Command Prompt window, and type :
- Replace myServer\instanceName with the name of the computer and the instance of SQL Server that you want to connect to. Press ENTER.
- The sqlcmd prompt (1→) indicates that you are connected to the specified instance of SQL Server.>