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 to fetch all the database name

Author  Topic 

prakashuj
Starting Member

12 Posts

Posted - 2008-01-03 : 23:53:26
Dear All,

Can any one help how to fetch all the Database name exist in that Server

eg: if Server1 is having DB1,DB2,DB3 Database,

how can i retrive all three database names

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-01-04 : 00:12:51
SELECT name FROM sys.databases

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-01-04 : 08:10:04
and more info can be found with

EXEC sp_databases
EXEC sp_helpdb


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -