Real newbie on SQL ....Know list database and table in SQL Server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sal21
    New Member
    • Jun 2006
    • 27

    Real newbie on SQL ....Know list database and table in SQL Server

    I use this macro to list in A column of sheet the name of sql server on my lan.
    Is possible to "scan server by server" and insert into column B the name of database and related table in column C, D, E, F...ecc...?
    Tks.




    Sub test_sql()
    Dim TEST As String
    Dim RIGA As String

    Set sqlApp = CreateObject("S QLDMO.Applicati on")

    Set serverList = sqlApp.ListAvai lableSQLServers

    numServers = serverList.Coun t
    RIGA = 2

    For I = 1 To numServers

    TEST = serverList(I)

    Range("A" + RIGA) = TEST
    RIGA = RIGA + 1
    Next

    Set sqlApp = Nothing

    End Sub
Working...