Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL Database Names

Posted on 2007-03-27
5
Medium Priority
?
210 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how the fundamental information of how to create a table.

721 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