Use the sqlcmd (osql) utility to list SQL Server servers in the Internet.
Source: Internet
Author: User
I have read SQL server for a few days.
The 2005 online help books are still gaining a lot. The new sqlcmd replaces SQL Server 2000's osql. I have never paid attention to using osql to list the SQL statements in the domestic network.
Server list. Two display modes are available for parameters. <1> sqlcmd
-LC: \ Documents ents 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> compare two methods. We can see that the server list with the-LC parameter is more suitable Code Analysis. For details about how to obtain the list by using code, refer to Article . 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:
The header line, and each server line to be listed has no leading space. This is called clearing output. Clearing output can improve the processing performance of the script language.
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.