Is there any way I could find out programmaticaly what databases exist on a server? It's because I would like to show user all available databases and allow him to choose the one he's interested in.
+2
A:
If you mean, "Which databases are on a specific instance of SQL Server", then the stored procedure sp_databases
(accessible via Master) will help you.
Rowland Shaw
2009-06-18 08:31:00
+1
A:
use Microsoft.SqlServer.Management.Smo, it lets you query for servers and databases, specifically when you call SmoApplication.EnumAvailableSqlServers().
Miki Watts
2009-06-18 08:34:49
A:
Would depend on which database you were referring to. Each db has their own way of querying these meta info.
Michael
2009-06-18 08:45:00
question is tagged 'sqlserver'
Remus Rusanu
2009-06-18 08:50:01
That tag was added after the accepted answer had been accepted
Rowland Shaw
2009-06-18 13:06:55