August 30, 2006 at 5:18 am
Hi
I want to get SQL Server version. I know this way: Select @@version
But this gives me a very long string, i.e.
Microsoft SQL Server 2000 - 8.00.194 (Intel X86) Aug 18 2005 00:57:48
Copyright (c) 1988-2000 Microsoft Corporation Personal Edition on Windows
NT 5.0 (Build 2195: Service Pack 4)
I just want the the major version number 2000 or 8 or 9 whatever maybe.
How do I get these numbers only?
Regards,
Ravi Shankar
August 30, 2006 at 5:46 am
In the past when building a Server Inventory list I used the following:
SELECT SUBSTRING(@@VERSION,1,CHARINDEX('(',@@VERSION,1)-1)
August 30, 2006 at 7:18 am
select @@version
SELECT SUBSTRING(@@VERSION,21,CHARINDEX('(',@@VERSION,1)-21)
should give you just the version number major and minor part without text
MVDBA
August 30, 2006 at 7:26 am
Alternatively,
Just use the interal serverproperty function.
select
serverproperty('ProductVersion')
August 31, 2006 at 4:34 am
select
replace( cast ( serverproperty('ProductVersion') as char(15)),'.','') as NumbersOnly
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
August 31, 2006 at 6:41 am
Thanks
August 31, 2006 at 6:41 am
Thanks
August 31, 2006 at 6:42 am
Thanks
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply