SQL Server -- use the sqlcmd command to find all available SQL Server instances in the local network

Source: Internet
Author: User
Tags sql server management studio

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.