Created
April 24, 2020 14:13
-
-
Save spaghettidba/95c7c3c6339a9318943cb98922ec14a7 to your computer and use it in GitHub Desktop.
sql version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @ProductVersion varchar(15); | |
DECLARE @Edition varchar(15); | |
DECLARE @EngineEdition smallint; | |
DECLARE @HostPlatform varchar(15); | |
SELECT @ProductVersion = CAST(SERVERPROPERTY('ProductVersion') AS varchar(15)), | |
@Edition = CAST(SERVERPROPERTY('Edition') AS varchar(15)), | |
@EngineEdition = CAST(SERVERPROPERTY('EngineEdition') AS smallint) | |
DECLARE @Version int | |
SET @Version = LEFT(@ProductVersion, CHARINDEX('.', @ProductVersion) - 1) | |
IF @Version >= 14 | |
BEGIN | |
SELECT @HostPlatform = host_platform | |
FROM sys.dm_os_host_info | |
END | |
ELSE | |
BEGIN | |
SET @HostPlatform = 'Windows' | |
END | |
SELECT @ProductVersion AS ProductVersion, | |
@Edition AS Edition, | |
@EngineEdition AS EngineEdition, | |
@HostPlatform AS HostPlatform |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment