I am doing automation of security bulleting of SQL Server and I need to extract security bulletin version from @@version
select @@version
Output
Microsoft SQL Server 2014 (SP2) (KB3171021) - 12.0.5000.0 (X64)
Jun 17 2016 19:14:09
Copyright (c) Microsoft Corporation
Enterprise Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)
I need to extract information (KB3171021) from above output.
This is something I tried
DECLARE @version NVARCHAR(400)
SELECT @version = REVERSE(SUBSTRING(@@version, 0, 50))
SELECT @version
SELECT SUBSTRING(@version, (CHARINDEX('(', REVERSE(@@VERSION))),(CHARINDEX(')', REVERSE(@@VERSION))))
I am not getting desired output. Can you please help?