You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not full support for SQL Server on Linux, but it does fix two bugs that occurred when running on SQL Server 2017 RC2 on Ubuntu.
- The first was to do with trace files, where a backslash was used for the path separator.
- The second was to do with a minimum value of `DATETIMEOFFSET` failing when casting to `DATETIME`.
- The third was a bonus for detecting the version of operating system, using `sys.dm_host_info` if available.
WHEN [owi].[windows_release] ='5'THEN'You''re running a really old version: Windows 2000, version '+CAST([owi].[windows_release] ASVARCHAR(5))
6550
-
WHEN [owi].[windows_release] >'5'AND [owi].[windows_release] <'6'THEN'You''re running a really old version: Windows Server 2003/2003R2 era, version '+CAST([owi].[windows_release] ASVARCHAR(5))
6551
-
WHEN [owi].[windows_release] >='6'AND [owi].[windows_release] <='6.1'THEN'You''re running a pretty old version: Windows: Server 2008/2008R2 era, version '+CAST([owi].[windows_release] ASVARCHAR(5))
6552
-
WHEN [owi].[windows_release] ='6.2'THEN'You''re running a rather modern version of Windows: Server 2012 era, version '+CAST([owi].[windows_release] ASVARCHAR(5))
6553
-
WHEN [owi].[windows_release] ='6.3'THEN'You''re running a pretty modern version of Windows: Server 2012R2 era, version '+CAST([owi].[windows_release] ASVARCHAR(5))
6554
-
WHEN [owi].[windows_release] >'6.3'THEN'Hot dog! You''re living in the future! You''re running version '+CAST([owi].[windows_release] ASVARCHAR(5))
6555
-
ELSE'I have no idea which version of Windows you''re on. Sorry.'
6579
+
WHEN [ohi].[host_platform] ='Linux'THEN'You''re running the '+CAST([ohi].[host_distribution] ASVARCHAR(35)) +' distribution of '+CAST([ohi].[host_platform] ASVARCHAR(35)) +', version '+CAST([ohi].[host_release] ASVARCHAR(5))
6580
+
WHEN [ohi].[host_platform] ='Windows'AND [ohi].[host_release] ='5'THEN'You''re running a really old version: Windows 2000, version '+CAST([ohi].[host_release] ASVARCHAR(5))
6581
+
WHEN [ohi].[host_platform] ='Windows'AND [ohi].[host_release] >'5'AND [ohi].[host_release] <'6'THEN'You''re running a really old version: '+CAST([ohi].[host_distribution] ASVARCHAR(50)) +', version '+CAST([ohi].[host_release] ASVARCHAR(5))
6582
+
WHEN [ohi].[host_platform] ='Windows'AND [ohi].[host_release] >='6'AND [ohi].[host_release] <='6.1'THEN'You''re running a pretty old version: Windows: '+CAST([ohi].[host_distribution] ASVARCHAR(50)) +', version '+CAST([ohi].[host_release] ASVARCHAR(5))
6583
+
WHEN [ohi].[host_platform] ='Windows'AND [ohi].[host_release] ='6.2'THEN'You''re running a rather modern version of Windows: '+CAST([ohi].[host_distribution] ASVARCHAR(50)) +', version '+CAST([ohi].[host_release] ASVARCHAR(5))
6584
+
WHEN [ohi].[host_platform] ='Windows'AND [ohi].[host_release] ='6.3'THEN'You''re running a pretty modern version of Windows: '+CAST([ohi].[host_distribution] ASVARCHAR(50)) +', version '+CAST([ohi].[host_release] ASVARCHAR(5))
6585
+
WHEN [ohi].[host_platform] ='Windows'AND [ohi].[host_release] >'6.3'THEN'Hot dog! You''re living in the future! You''re running '+CAST([ohi].[host_distribution] ASVARCHAR(50)) +', version '+CAST([ohi].[host_release] ASVARCHAR(5))
6586
+
ELSE'You''re running '+CAST([ohi].[host_distribution] ASVARCHAR(35)) +', version '+CAST([ohi].[host_release] ASVARCHAR(5))
6556
6587
END
6557
6588
) AS [Details]
6558
-
FROM [sys].[dm_os_windows_info] [owi];
6559
-
6589
+
FROM [sys].[dm_os_host_info] [ohi];
6560
6590
END;
6591
+
ELSE
6592
+
BEGIN
6593
+
-- Otherwise, stick with Windows-only detection
6594
+
6595
+
IFEXISTS ( SELECT1
6596
+
FROMsys.all_objects
6597
+
WHEREname='dm_os_windows_info' )
6598
+
6599
+
BEGIN
6600
+
6601
+
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 172) WITHNOWAIT;
WHEN [owi].[windows_release] ='5'THEN'You''re running a really old version: Windows 2000, version '+CAST([owi].[windows_release] ASVARCHAR(5))
6619
+
WHEN [owi].[windows_release] >'5'AND [owi].[windows_release] <'6'THEN'You''re running a really old version: Windows Server 2003/2003R2 era, version '+CAST([owi].[windows_release] ASVARCHAR(5))
6620
+
WHEN [owi].[windows_release] >='6'AND [owi].[windows_release] <='6.1'THEN'You''re running a pretty old version: Windows: Server 2008/2008R2 era, version '+CAST([owi].[windows_release] ASVARCHAR(5))
6621
+
WHEN [owi].[windows_release] ='6.2'THEN'You''re running a rather modern version of Windows: Server 2012 era, version '+CAST([owi].[windows_release] ASVARCHAR(5))
6622
+
WHEN [owi].[windows_release] ='6.3'THEN'You''re running a pretty modern version of Windows: Server 2012R2 era, version '+CAST([owi].[windows_release] ASVARCHAR(5))
6623
+
WHEN [owi].[windows_release] >'6.3'THEN'Hot dog! You''re living in the future! You''re running version '+CAST([owi].[windows_release] ASVARCHAR(5))
6624
+
ELSE'I have no idea which version of Windows you''re on. Sorry.'
6625
+
END
6626
+
) AS [Details]
6627
+
FROM [sys].[dm_os_windows_info] [owi];
6628
+
6629
+
END;
6630
+
END;
6561
6631
END;
6562
6632
6563
6633
/*
@@ -6730,13 +6800,15 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
6730
6800
6731
6801
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 83) WITHNOWAIT;
6732
6802
6803
+
-- DATETIMEOFFSET and DATETIME have different minimum values, so there's
6804
+
-- a small workaround here to force 1753-01-01 if the minimum is detected
6733
6805
SET @StringToExecute ='INSERT INTO #BlitzResults (CheckID, Priority, FindingsGroup, Finding, URL, Details)
6734
6806
SELECT 83 AS CheckID ,
6735
6807
250 AS Priority ,
6736
6808
''Server Info'' AS FindingsGroup ,
6737
6809
''Services'' AS Finding ,
6738
6810
'''' AS URL ,
6739
-
N''Service: '' + servicename + N'' runs under service account '' + service_account + N''. Last startup time: '' + COALESCE(CAST(CAST(last_startup_time AS DATETIME) AS VARCHAR(50)), ''not shown.'') + ''. Startup type: '' + startup_type_desc + N'', currently '' + status_desc + ''.''
6811
+
N''Service: '' + servicename + N'' runs under service account '' + service_account + N''. Last startup time: '' + COALESCE(CAST(CASE WHEN YEAR(last_startup_time) <= 1753 THEN CAST(''17530101'' as datetime) ELSE CAST(last_startup_time AS DATETIME) END AS VARCHAR(50)), ''not shown.'') + ''. Startup type: '' + startup_type_desc + N'', currently '' + status_desc + ''.''
6740
6812
FROM sys.dm_server_services OPTION (RECOMPILE);';
6741
6813
6742
6814
IF @Debug =2AND @StringToExecute ISNOTNULLPRINT @StringToExecute;
0 commit comments