Microsoft SQL Server - select database using transact sql

by
Jeremy Canfield |
Updated: June 30 2021
| 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