Skip to main content

SQL Server DB inventory

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

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', 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 ( not in ('master', 'model', 'msdb', 'tempdb'));


Popular posts from this blog