Use sqlcmd (osql) to query SQL Server instances

Source: Internet
Author: User
Zheng Zuo 2005-2-27 recently read the SQL Server 2000 online help books for a few days. The gains are still relatively large. The new sqlcmd replaces the SQL Server osql, I have never noticed that I can use osql to list the SQL Server servers in the Internet. Two display modes are available for parameters. <1> sqlcmd-LC:/Documents and Settings/Administrator> sqlcmd-l server: data11 dfc12 h2data SYC/nbjg SYC/sqlexpress zhhaif zhengzuo C: /Documents and Settings/Administrator> <2> sqlcmd-svc:/Documents and Settings/Administrator> sqlcmd-lcdata11dfc12h2datasyc/nbjgsyc/sqlexpresszhhaifzhengzuo C: /Documents and Settings/Administrator>: You can see that the list of servers listed with the-LC parameter is more suitable for code analysis. For more information about how to obtain the list through code, see my previous articles. The following content describes the command items in online books, which should be noted during usage: -L [c] lists the names of the Servers configured locally and the servers broadcast on the network. This parameter cannot be used with other parameters. The maximum number of servers that can be listed is 3000. If the server list is truncated due to the buffer size, an error message is displayed. Due to the nature of network broadcast, sqlcmd may not be able to receive responses from all servers in a timely manner. Therefore, the list of returned servers may be different each time this option is called. If the optional parameter C is specified, the output will not display servers: header line, and each server line listed has no leading space. This is called clearing output. Clearing output can improve the processing performance of the script language.

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.