Solved

SQL Database Names

Posted on 2007-03-27
5
204 Views
Last Modified: 2010-03-19
Visual C# Windows Application.

Is it possible and if so how do you query the SQL Database Names when you have the Server Name and Instance?

For instance:  I know the server name is SQLSERVER1  and the instance is SQLEXPRESS.  How do I get a list of the 3 or 4 databases on that server: master, mydatabase, etc.

Thanks for the help.
0
Comment
Question by:sneeri_c
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 18799446
you need access to the master database...

select * from master..sysdatabases
0
 
LVL 11

Expert Comment

by:Ved Prakash Agrawal
ID: 18799447
Used SQL-DMO which provide extensibly feature to manage complete server.
0
 
LVL 11

Expert Comment

by:Ved Prakash Agrawal
ID: 18799457
http://www.csharphelp.com/archives2/archive342.html

tried to look this link may be you will get u r answer .......cheers!!!!!!!!!!

0
 
LVL 18

Expert Comment

by:Sham Haque
ID: 18799522
a wise expert once said to use master views rather than tables wherever poss:

SELECT [CATALOG_NAME]
FROM [master].[INFORMATION_SCHEMA].[SCHEMATA]
0
 
LVL 1

Accepted Solution

by:
google-web-info earned 500 total points
ID: 18799730
Hey Sneeri_C,

Because the code is too long, so i uploaded an demo and source code here: http://google-web.info/download/sqldatabases.zip

You can test the demo and read out the source code easily,

Grz,
Joesy
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

734 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