May 2, 2016 at 3:47 am
How to get only version number from
select @@version
Result should be 2000/2005/2008/2012... only
and not the entire string as here:
Microsoft SQL Server 2008 R2 (SP3) - 10.50.6000.34 (X64)
Aug 19 2014 12:21:34
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
May 2, 2016 at 4:08 am
sqlnewbie17 (5/2/2016)
How to get only version number fromselect @@version
Result should be 2000/2005/2008/2012... only
and not the entire string as here:
Microsoft SQL Server 2008 R2 (SP3) - 10.50.6000.34 (X64)
Aug 19 2014 12:21:34
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
Quick suggestion
😎
SELECT SUBSTRING(@@VERSION,22,4) AS [only version number]
May 2, 2016 at 10:05 am
--pull first four digits in a row that start with 2, should be year.
SELECT SUBSTRING(@@VERSION, PATINDEX('%2[0-9][0-9][0-9]%', @@VERSION), 4)
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
May 2, 2016 at 12:11 pm
You can also pull all kinds of useful information from SERVERPROPERTY.
SELECT
SERVERPROPERTY('ProductVersion') AS ProductVersion,
SERVERPROPERTY('Edition') AS Edition
If you don't know the product name from the major builds versions you can always check them out here.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply