Bootstrap FreeKB - Microsoft SQL Server - select database using transact sql
Microsoft SQL Server - select database using transact sql

Updated:   |  Microsoft SQL Server articles

The select * from sys.databases command can be used to return the list of databases.

select * from sys.databases

 

However, this usually returns too many columns. Often, you may just want the names of the databases.

select name from sys.databases

 

Which should return just the database names, something like this.

foo
bar
db002

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 4836c9 in the box below so that we can be sure you are a human.