687
Looking to quickly gather detailed information on all the databases in your SQL Server? This T-SQL script provides a quick and efficient way to obtain key information on your databases. With just a few simple modifications, you can easily add or remove columns to fit your specific needs. Give it a try and see how it can improve your database operations.
T-Sql
---------------------------------------------------------------------------------------
-- This script retrieves basic information on all databases in your SQL Server Instance
---------------------------------------------------------------------------------------
SELECT
sdb.[name] AS DBName
, smf.[type_desc] AS FileType
, smf.physical_name AS PhysicalName
--, sdb.*
--, smf.*
FROM
sys.master_files smf
INNER JOIN sys.databases sdb
ON sdb.database_id = smf.database_id
--WHERE sdb.[name] in('dbname herre') -- modify this line to filter the result
ORDER BY
sdb.[name]
/* To use this script, simply copy and paste it into a new query window in SQL Server Management Studio, then execute the script to view the database information. */
/* You can modify the script to include additional columns or customize the WHERE clause to filter results based on specific database criteria. */