Solved

Retrieving list of current databases

Posted on 2004-04-21
3
175 Views
Last Modified: 2010-04-15
Does anyone have code to grab a list of database names on a SQL Server?
0
Comment
Question by:hobster
3 Comments
 
LVL 21

Assisted Solution

by:tovvenki
tovvenki earned 40 total points
ID: 10886072
use the following system stored procedure
exec sp_helpdb

regards,
venki
0
 
LVL 48

Accepted Solution

by:
AlexFM earned 60 total points
ID: 10886475
select * from master.dbo.SysDatabases

http://www.codeproject.com/cs/database/msde-gui.asp
0
 
LVL 23

Expert Comment

by:rama_krishna580
ID: 10886549
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question