While i was working with a c# application i got the need of getting all the database names in a combo box, i searched net 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..
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
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:
If you are working on master database, the query will be any one of the queries given below..
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
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 [...]
ReplyDelete