Lists the names of local SQL Servers, network SQL Servers, or both.
SqlServerEnum% ( searchmode%, serverbuf$, numentries% )
where
LOCSEARCH searches for the server names listed in the WIN.INI file. LOCSEARCH has the value 1.
NETSEARCH searches for server names on the network type defined by the default Net-Library. The VBSQL Library loads the default Net-Library set by the DSQUERY entry in the WIN.INI file. If no default entry exists, the VBSQL Library loads the named pipes Net-Library. NETSEARCH has the value 2.
(LOCSEARCH NETSEARCH) searches for server names using both methods, searching first for server names listed in the WIN.INI file and then for server names on the network type defined by the default Net-Library. A server name is listed twice if it is specified in the WIN.INI file and is also available on the default network type.
SqlServerEnum% returns one or more of the following status codes:
Constant | Value |
---|---|
ENUMSUCCESS% | 0 |
MOREDATA% | 1 |
NETNOTAVAIL% | 2 |
OUTOFMEMORY% | 4 |
NOTSUPPORTED% | 8 |
The SqlServerEnum% function returns a list of server names to the server$ buffer in the order in which it finds them. LOCSEARCH names are listed before NETSEARCH names. Only complete server names are copied to the buffer. Each server name is separated by a null character (chr$(0)).
The end of the list is designated by two consecutive null characters. If the buffer becomes full before SqlServerEnum% has finished sending names, SqlServerEnum% returns the value MOREDATA.
Note that on named pipes networks, SqlServerEnum% returns the server names of computers on which SQL Server is installed, regardless of whether or not SQL Server is currently running.