Tip of the Day : How to Get a List of SQL Server Servers on the Network

Welcome to SQL Server Helper !!!

This site is intended for those who are beginning to use SQL Server as part of their day-to-day activities.  You will find in this site a collection of useful functions, triggers, stored procedures and tips and tricks related to SQL Server.

Should you have any comments or questions regarding this site or if you want to ask SQL Server-related questions, e-mail us here.

We hope we are able to help and we are glad to help!!!

SQL Server Tip of the Day - October 21, 2018

How to Get a List of SQL Server Servers on the Network

For SQL Server 2005, SQL Server 2008 and later, to get a list of SQL Server servers on the network, the sqlcmd.exe utility can be used.  The sqlcmd utility lets you enter Transact-SQL statements, system procedures and script files at the command prompt.  One of the arguments that can be passed to the sqlcmd utility is “-Lc” which will list locally configured server computers, and the names of the server computers that are broadcasting on the network.  The “c” part of the “-Lc” argument stands for clean output and it means that the output appears without the Servers: header line and each server line is listed without leading spaces.

C:\> sqlcmd -Lc

For SQL Server 2000, the isql or osql utilities can be used.  Just like the sqlcmd utility, the isql and osql utilites allow you to enter Transact-SQL statements, system procedures and script files form the command prompt.  The osql utility uses ODBC to communicate with the server while the isql utility uses DB-Library to communicate with SQL Server 2000.  Unlike the sqlcmd utility, the clean output “c” argument option is not available and only the “-L” command argument is available.

C:\> osql -L

SQL Server 2012

SQL Server 2008

User-Defined Functions

Date Functions

A collection of useful user-defined functions that deal with dates.

String Functions

A collection of useful user-defined functions that deal with strings (varchar/char/nvarchar/nchar).

Tree Functions

A collection of useful user-defined functions that deal with tree or hierarchical design structures.

Table-Valued Functions

A collection of useful table-valued user-defined functions that can be used to join with other tables.

SQL Server Built-in Functions

A reference to all built-in functions available within SQL Server grouped into categories.

Tips and Tricks

A collection of useful SQL Server-related tips and tricks:

SQL Server Error Messages

A list of SQL Server error messages and for certain error messages, discusses ways on how to solve the error or work around them:

Frequently Asked Questions