List of Databases

Script to list databases available in a server using ADODB connection
From https://devblogs.microsoft.com/scripting/how-can-i-get-a-list-of-all-the-databases-on-a-sql-server-computer/


Public

Tested

Not My Work
<%
strComputer = “atl-ds-01”
Set objConnection = CreateObject(“ADODB.Connection”)
objConnection.Open “Provider=SQLOLEDB;Data Source=” & strComputer & “;Trusted_Connection=Yes;Initial Catalog=Master;”
Set objRecordset = objConnection.Execute(“Select Name From SysDatabases”)
If objRecordset.Recordcount = 0 Then
Response.Write “No databases could be found.”
Else
Do Until objRecordset.EOF
Response.Write objRecordset.Fields(“Name”)
objRecordset.MoveNext
Loop
End If
%>

Views 254 Downloads 62

SQL Database
ANmarAmdeen
644
Revisions

v1.0