Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)
How to get the list of available databases on the SQL Server instance? I am planning to make a list of them in a combo box in VB.NET. How to get the list of available databases on the SQL Server instance? I am planning to make a list of them in a combo box in VB.NET.

1 Answer

0 votes
by (12.7k points)

You can execute the following code:

SELECT name FROM master.sys.databases

This is the best way now, rather than dbo.sysdatabases, which has been deprecated for some time.

or if you prefer:

EXEC sp_databases

Sign up for this SQL Course by Intellipaat fast, to Learn SQL concepts in detail and get certified.

Browse Categories

...