forked from samyan19/SQL-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServer Info Pivot Table.sql
More file actions
39 lines (28 loc) · 877 Bytes
/
Server Info Pivot Table.sql
File metadata and controls
39 lines (28 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
DECLARE @clusNodes VARCHAR(MAX)
SELECT @clusNodes = COALESCE(@clusNodes+',' ,'') + NodeName
FROM sys.dm_os_cluster_nodes;
--exec xp_msver
--select RIGHT(@@version, LEN(@@version)- 3 -charindex (' ON ', @@VERSION))
;with cte as(
select
@@SERVERNAME as sql_instance_name,
serverproperty('isclustered') as 'is_clustered',
case when serverproperty('isclustered')=1
then @clusNodes
else null end as 'cluster_nodes',
virtual_machine_type_desc,
SERVERPROPERTY('productversion') as product_version,
SERVERPROPERTY('edition') as edition,
SERVERPROPERTY('productlevel') as product_level,
cpu_count,
physical_memory_in_bytes/1024/1024 as memory,
RIGHT(SUBSTRING(@@VERSION,
CHARINDEX('Windows NT', @@VERSION), 14), 3) as windows_version
FROM sys.dm_os_sys_info
)
select
db_name(database_id) as db_name,
type_desc,
(size*8)/1024 as size_mb,
cte.*
from sys.master_files, cte