Groups | Blog | Home
all groups > sql server (microsoft) > august 2005 >

sql server (microsoft) : @@version not quite right


bdog_jdog
8/26/2005 10:56:48 AM
Hi All,
I was going to apply SP4 to the SQL server in my test environment, and
did Select @@Version and was surprised to see SP1.

I applied SP3 manually months ago.

I then did serverproperty('ProductLevel') and select
serverproperty('ProductVersion') and got the right answers, SP3 and
8.00.760.

Not sure why @@Version gives me the wrong answer.

Any ideas?

Thanks All, B
xAvailx
8/26/2005 11:16:08 AM
I think @@Version reports the OS SP, not the SQL Server SP.

HTH,

BZ
combfilter
8/29/2005 3:07:26 PM
In article <1125079008.111448.303140@o13g2000cwo.googlegroups.com>,
bentorrey@gmail.com says...
[quoted text, click to view]
@@version should show you correct. It does on all of our sp3. Strange.

http://vyaskn.tripod.com/sqlsps.htm

xAvailx
8/30/2005 1:34:50 PM
This is my result from running @@version

Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002
14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Developer
Edition on Windows NT 5.1 (Build 2600: Service Pack 2)

If you are referring to the "Build 2600: Service Pack 2", that is the
Windows OS SP, not SQL Servers. If you want to use @@version to
determine your SQL Server SP, you have to look at the build number.

8.00.760 << 760 = SP3

SQL Server MVP Vyas has a useful table that maps Build # to SPs.

http://vyaskn.tripod.com/sqlsps.htm

HTH,

BZ
Mike Smith
8/30/2005 4:23:47 PM
On 26 Aug 2005 10:56:48 -0700, "bdog_jdog" <bentorrey@gmail.com>
[quoted text, click to view]


Hmmm, this is the same thing happening to me. I thought for sure I
Mike Smith
8/30/2005 4:30:08 PM
On 26 Aug 2005 10:56:48 -0700, "bdog_jdog" <bentorrey@gmail.com>
[quoted text, click to view]


I found a handy script which decodes the issue:

/*
This script originally lived at http://evolvedcode.net/

For the original version of this script and a wide variety
of other code and scripts, please visit the site.

- EvolvedCode.net staff


Changes:
14.10.2002
Included pre-release tests

*/

DECLARE @sVersion VARCHAR(1000)
DECLARE @iVersion FLOAT, @iRevision INT

SELECT @sVersion = @@VERSION

--Drop everything before the dash and everything after the open
bracket
SET @sVersion = SUBSTRING( @sVersion, CHARINDEX( '-', @sVersion )+1,
CHARINDEX( '(', @sVersion ) - CHARINDEX( '-', @sVersion ) - 1 )
--Clean up the string
SET @sVersion = LTRIM(RTRIM( @sVersion ))

--Translate
SET @iVersion = CAST( LEFT( @sVersion, 4 ) AS FLOAT )
SET @iRevision = CAST( RIGHT( @sVersion, LEN( @sVersion )-5 ) AS INT )

--Figure out what state the boxes are in
PRINT 'Current version string: '''+@sVersion+''', testing
configuration...'
PRINT ''

PRINT CASE
WHEN @iVersion = 6.00 THEN 'MS SQL Server 6.0'
WHEN @iVersion = 6.50 THEN 'MS SQL Server 6.5'
WHEN @iVersion = 7.00 THEN 'MS SQL Server 7.0'
WHEN @iVersion = 8.00 THEN 'MS SQL Server 2000'
ELSE 'MS SQL Server (Unknown version)'
END
+ ' ' +
CASE
--SQL Server 6.0
WHEN @iVersion = 6.00 AND @iRevision < 121 THEN 'Pre-Release'
WHEN @iVersion = 6.00 AND @iRevision = 121 THEN 'Release'
WHEN @iVersion = 6.00 AND @iRevision < 124 THEN 'between Release and
SP1'
WHEN @iVersion = 6.00 AND @iRevision = 124 THEN 'SP1'
WHEN @iVersion = 6.00 AND @iRevision < 139 THEN 'between SP1 & SP2'
WHEN @iVersion = 6.00 AND @iRevision = 139 THEN 'SP2'
WHEN @iVersion = 6.00 AND @iRevision < 151 THEN 'between SP2 & SP3'
WHEN @iVersion = 6.00 AND @iRevision = 151 THEN 'SP3'
WHEN @iVersion = 6.00 AND @iRevision < 9999 THEN 'SP3 or higher'

--SQL Server 6.5
WHEN @iVersion = 6.50 AND @iRevision < 201 THEN 'Pre-Release'
WHEN @iVersion = 6.50 AND @iRevision = 201 THEN 'Release'
WHEN @iVersion = 6.50 AND @iRevision < 213 THEN 'between Release and
SP1'
WHEN @iVersion = 6.50 AND @iRevision = 213 THEN 'SP1'
WHEN @iVersion = 6.50 AND @iRevision < 240 THEN 'between SP1 & SP2'
WHEN @iVersion = 6.50 AND @iRevision = 240 THEN 'SP2'
WHEN @iVersion = 6.50 AND @iRevision < 258 THEN 'between SP2 & SP3'
WHEN @iVersion = 6.50 AND @iRevision = 258 THEN 'SP3'
WHEN @iVersion = 6.50 AND @iRevision < 281 THEN 'between SP3 & SP4'
WHEN @iVersion = 6.50 AND @iRevision = 281 THEN 'SP4'
WHEN @iVersion = 6.50 AND @iRevision < 415 THEN 'between SP4 & SP5'
WHEN @iVersion = 6.50 AND @iRevision = 415 THEN 'SP5'
WHEN @iVersion = 6.50 AND @iRevision < 416 THEN 'between SP5 & SP5a'
WHEN @iVersion = 6.50 AND @iRevision = 416 THEN 'SP5a'
WHEN @iVersion = 6.50 AND @iRevision < 9999 THEN 'SP5a or higher'

--SQL Server 7
WHEN @iVersion = 7.00 AND @iRevision < 623 THEN 'Pre-Release'
WHEN @iVersion = 7.00 AND @iRevision = 623 THEN 'Release'
WHEN @iVersion = 7.00 AND @iRevision < 699 THEN 'between Release and
SP1'
WHEN @iVersion = 7.00 AND @iRevision = 699 THEN 'SP1'
WHEN @iVersion = 7.00 AND @iRevision < 842 THEN 'between SP1 and
SP2'
WHEN @iVersion = 7.00 AND @iRevision = 842 THEN 'SP2'
WHEN @iVersion = 7.00 AND @iRevision < 961 THEN 'between SP2 and
SP3'
WHEN @iVersion = 7.00 AND @iRevision = 961 THEN 'SP3'
WHEN @iVersion = 7.00 AND @iRevision < 1063 THEN 'between SP3 and
SP4'
WHEN @iVersion = 7.00 AND @iRevision = 1063 THEN 'SP4'
WHEN @iVersion = 7.00 AND @iRevision < 9999 THEN 'SP4 or higher'

--SQL Server 2000
WHEN @iVersion = 8.00 AND @iRevision < 194 THEN 'Pre-Release'
WHEN @iVersion = 8.00 AND @iRevision = 194 THEN 'Release'
WHEN @iVersion = 8.00 AND @iRevision < 384 THEN 'between Release and
SP1'
WHEN @iVersion = 8.00 AND @iRevision = 384 THEN 'SP1'
WHEN @iVersion = 8.00 AND @iRevision < 534 THEN 'between SP1 and
SP2'
WHEN @iVersion = 8.00 AND @iRevision = 534 THEN 'SP2'
WHEN @iVersion = 8.00 AND @iRevision < 760 THEN 'between SP2 and
SP3'
WHEN @iVersion = 8.00 AND @iRevision = 760 THEN 'SP3'
WHEN @iVersion = 8.00 AND @iRevision < 9999 THEN 'SP3 or higher'

--None of the above
ELSE ''

END

aaron.kempf NO[at]SPAM gmail.com
9/11/2005 9:44:34 AM
are you running sql server or msde?
i think that applying full service packs to msde installs should work;
from where i've been; if you try to install sp3 to msde; it won't say
'failed' or anything like that.. it just wont do anythign

i noted that about a year ago tho; it might be fixed with sp4 per se
AddThis Social Bookmark Button