Retrieving List of All DataBases in Sql Server
While i was working with a C# application I got the need of getting all the database names in a ComboBox, I googled and found some queries to get the list of all database names.
If you are working on master database, the query will be any one of the queries given below..
1 2 3 |
SELECT name FROM sysdatabases SELECT name FROM sys.databases |
If you are working with any databases including master, there are few queries to get the names of all databases, you can use any of them
1 2 3 4 5 6 7 |
SELECT name FROM sys.sysdatabases SELECT name FROM master.sys.databases SELECT name FROM master..sysdatabases SELECT name FROM master.sys.sysdatabases |
Output will be as in the image below:
[…] Post u may like : Retrieving List of All DataBases in Sql Server […]