Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

Retrieving list of current databases

Does anyone have code to grab a list of database names on a SQL Server?
0
hobster
Asked:
hobster
2 Solutions
 
tovvenkiCommented:
use the following system stored procedure
exec sp_helpdb

regards,
venki
0
 
AlexFMCommented:
select * from master.dbo.SysDatabases

http://www.codeproject.com/cs/database/msde-gui.asp
0
 
rama_krishna580Commented:
try this.....

The SQL Server specific way (all versions) is :-

select name from master..sysdatabases

The ANSI standard way (SQL 7 only) is :-

select CATALOG_NAME from INFORMATION_SCHEMA.SCHEMATA

Best of Luck

R.K


0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now