Skip to main content

SQL Server DB inventory

with the following query db inventory of a sql server can be retrieved:

SELECT
SERVERPROPERTY('ServerName') as 'Server Name',
@@VERSION as 'SQL Version',
SERVERPROPERTY('productversion') as 'SQL Server Versiyon Number',
CASE SERVERPROPERTY('IsIntegratedSecurityOnly') WHEN 0 THEN 'Mix' ELSE 'Windows' END as 'Auth Mode',
dbs.name as 'Database Name',
dbs.collation_name as 'Collation',
mf.physical_name as 'Database File'
FROM sys.master_files as mf, sys.databases as dbs
WHERE (mf.database_id dbs.database_id) and (dbs.name not in ('master', 'model', 'msdb', 'tempdb'));

Comments

Popular posts from this blog