Find List of all databases in sql server use the below methods.
Method 1:
Below query will be applicable for SQL Server 2000+ version (Contains 12 columns)
SELECT * FROM dbo.sysdatabases
Below query extract information about databases with more information (ex: State, Isolation, recovery model etc.)
Note: This is a catalog view and will be available SQL SERVER 2005+ versions
SELECT * FROM sys.databases
Method 3:
To see just database names you can use undocumented sp_MSForEachDB
EXEC sp_MSForEachDB 'SELECT ''?'' AS DatabaseName'
Method 4:
Below SP will help you to provide database size along with databases name , owner, status etc. on the server.
EXEC sp_helpdb
Method 5
Similarly, below stored procedure will give database name, database size and Remarks
EXEC sp_databases
Related Article:
- Retrieve information on backup and restore operations in SQL Server
- Return list of SQL Agent jobs with schedule information in SQL Server
- Count the Number of Tables in a Database in SQL Server
- Retrieve List of all Stored Procedures in SQL Server
- Display all data files for all databases with size and growth info in SQL Server
- Get all schemas, tables, columns and indexes in SQL Server
- Retrieve all Table detail from Known Column in SQL Server
- Get the list of all databases on a server in SQL Server
- Show Size of All Tables in Current Database in SQL Server
No comments:
Post a Comment