List all databases in SQL Server

Here are few ways  to list all databases in SQL Server

SELECT database_id, name from sys.databases 
GO
SELECT dbid, name from sysdatabases 
GO
sp_helpdb
GO
sp_databases
GO
sp_MSforeachDB ' PRINT ''?'' '

 

Like us on FaceBook Join the fastest growing SQL Server group on FaceBook

Data Platform Virtual Summit 2020

Subscribe to SQLServerGeeks YouTube channel. If you want more learning content in your inbox, subscribe to SQLServerGeeks Bulletin.

SQLServerGeeks YouTube | SQLServerGeeks Bulletin | SQLServerGeeks Twitter

Leave a Reply

Your email address will not be published. Required fields are marked *