iCeriver provides:
Use the following SQL statement
XP_cmdshell 'osql -l'
The return value is this format:
NULL
server:
(Local)
9x1
9xserver1
AAAAA
NULL
Babytony provides:
Another way to list all SQL servers in the LAN
Upstairs introduced the SP provided by the server-side SQL Server to return a data set. In addition, introducing a method for obtaining a SQL server list with SQL Server client DMO objects, you need to apply #microsoft sqldmo object librage in VB program, usually this file is in / program files / Microsoft SQL Server / 80 / Tools / BINN / SqldMo.dll:
DIM OAPP AS New SqldMo.Application
Dim onamelist as namelist
DIM I as integer
ON Error Goto Errorhandler:
Set onamelist = OApp.listavailablesqlservers
For i = 1 to onamelist.count
LSTSERVER.AddItem onamelist.Item (i)
Next i
Set onamelist = Nothing
Set OAPP = Nothing
Computer World Developer Club
http://www.dev-club.com