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

   

Leave a Reply

Your email address will not be published.