In general, we can use connect to server in SQL Server Management studio to query and try to connect all available SQL Server instances in the local network, such:
In Visual Studio, you can also use tools> connect to database to query and connect available SQL Server instances in the local network.
In addition, SQL Server provides a sqlcmd commandProgramTo implement this function. In SQL Server2000, this command is called iSQL, but it has been renamed sqlcmd in the new version of SQL Server (SQL server2008 can also use osql commands ).
To see if this command is used.
Enter "osql-L" or "sqlcmd-L" in the Windows Command Line (note that l is capitalized ). For example, the command prints the results of the queried SQL server instance.
Note that the difference between osql and sqlcmd is that a local occurs in the results displayed by osql. In the preceding example, it is actually the same as SQL. We can see that sqlcmd also provides the correct results.