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

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

 

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |