Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server Lists

Status
Not open for further replies.

YorkyUK

Programmer
Jun 12, 2001
5
0
0
GB
I am writing a VB application to manage data in a SQL database, The tool has to be able to pull details from other databases on the server. ie table names etc.
Got all that working fine.
Now I have been requested to modify the utility so that it can get data from other SQL servers.
Is there any way to get a list of available SQL servers from NT?
 
I don't any way of finding out this information from the NT in a suitable generic way.

At our site we have an ini.file which holds the existing SQL Server names and their corresponding machine names and a few other useful details. This method of course does need the occasional bit of maintenance when we add or remove a server.

One possible way is that if you run SMS at your site or something similar then you could possibly pull the names off the SMS database.

Hope this helps

Rick.
 

You can use SQL DMO to list the SQL Servers. I found this code snippet in a News Group. Works fine.

Sub ListSQLServers()
'Posted to microsoft.public.vb.database
'by Steven Bras, MCSD
'Microsoft Developer Support/Visual Basic WebData

Dim oSQL As New SQLDMO.Application
Dim oNamelist As NameList

Set oNamelist = oSQL.ListAvailableSQLServers()

For x = 1 To oNamelist.Count
Debug.Print oNamelist(x)
Next

End Sub

SQL DMO is an object library for Visual Basic. Read about it in SQL BOL under the topic "SQL Distributed Management Objects." Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Cheers sounds like just what I want.

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top