Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How do you return a list of databases on a server

Author  Topic 

im1dermike
Posting Yak Master

222 Posts

Posted - 2008-10-03 : 10:52:44
I'm writing an ASP application in C# and I'm wondering how/if you can query a server to return a list of all the databases.

hanbingl
Aged Yak Warrior

652 Posts

Posted - 2008-10-03 : 10:57:45

select name from master.dbo.sysdatabases
Go to Top of Page

im1dermike
Posting Yak Master

222 Posts

Posted - 2008-10-03 : 11:01:50
You're awesome. Thanks!
Go to Top of Page

jhocutt
Constraint Violating Yak Guru

385 Posts

Posted - 2008-10-03 : 11:09:03
exec master.dbo.sp_databases


"God does not play dice" -- Albert Einstein
"Not only does God play dice, but he sometimes throws them where they cannot be seen."
-- Stephen Hawking
Go to Top of Page
   

- Advertisement -