How do I get version info etc without using...

Last post 10-07-2008 2:54 PM by MohammedU. 10 replies.
Page 1 of 1 (11 items)
Active Topics My Discussions Unanswered Sort Posts: Previous Next
  • 10-06-2008 10:23 AM

    How do I get version info etc without using...

    How do I get version info etc without using... SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition') ??????? This is different for SQL Server 7.0. I want to list the server name too. Thanks
  • 10-06-2008 10:37 AM In reply to

    • tsturr
    • Not Ranked
    • Joined on 10-06-2008
    • Posts 1

    Re: How do I get version info etc without using...

    SELECT @@servername will provide you the servername, @@version will provide version information as well.


    Ted

  • 10-07-2008 8:51 AM In reply to

    Re: How do I get version info etc without using...

    Thanks - but how do I separate the info into each individual bit?
  • 10-07-2008 8:51 AM In reply to

    Re: How do I get version info etc without using...

    Thanks - but how do I separate the info into each individual bit? ie
  • 10-07-2008 8:51 AM In reply to

    Re: How do I get version info etc without using...

    Thanks - but how do I separate the info into each individual bit? ie version
  • 10-07-2008 8:51 AM In reply to

    Re: How do I get version info etc without using...

    Thanks - but how do I separate the info into each individual bit? ie edition
  • 10-07-2008 8:51 AM In reply to

    Re: How do I get version info etc without using...

    Thanks - but how do I separate the info into each individual bit? ie edition name,
  • 10-07-2008 8:51 AM In reply to

    Re: How do I get version info etc without using...

    Thanks - but how do I separate the info into each individual bit? ie edition name, version
  • 10-07-2008 8:51 AM In reply to

    Re: How do I get version info etc without using...

    Thanks - but how do I separate the info into each individual bit? ie edition name, version number
  • 10-07-2008 9:14 AM In reply to

    Re: How do I get version info etc without using...

    Well, that's where you need to use the SERVERPROPERTY syntax ...

  • 10-07-2008 2:54 PM In reply to

    Re: How do I get version info etc without using...

    If you don't want to user server property...then you can use @@version or xp_msver use temp table and/or CHARINDEX function to get the info...

     Ex:

    create table #versioninfo

     [Index] varchar(5),
     [Name] varchar(20),
     Internal_Value varchar(10),
     Character_Value varchar(120)
    )   
    insert into #versioninfo exec ('xp_msver')
    declare @sqlver varchar(10),
     @winver varchar(10),
     @cpuspeedcount varchar(3),
     @Memory varchar(4),
     @currentEditonstart varchar(3),
     @Editionlength varchar(3),
     @installdatestart varchar(10)
     select   Character_Value as ProductVersion, left(@@servername, 25) as 'SQL_server_name'  from #versioninfo where Name in( 'ProductVersion')

    --   (select Character_Value from #versioninfo where Name = 'WindowsVersion')
    --   (select Internal_Value from #versioninfo where Name = 'ProcessorCount')
    --  (select Internal_Value from #versioninfo where Name = 'PhysicalMemory')

    create table #searchstring (location varchar(3))
    insert into #searchstring values (charindex('Standard', @@version))
    insert into #searchstring values (charindex('Enterprise', @@version))
    insert into #searchstring values (charindex('Developer', @@version))
    insert into #searchstring values (charindex('Personal', @@version))
    insert into #searchstring values (charindex('desktop', @@version))


    set @currentEditonstart = (select * from #searchstring where location > 0)
    set @Editionlength = charindex('Edition', @@version) - @currentEditonstart + 7
     set @sqlver = (select Character_Value from #versioninfo where Name = 'ProductVersion')
    SELECT left(@@servername, 25) as 'SQL_server_name' , @@VERSION,
    left(substring(@@version, cast( @currentEditonstart as int), cast( @Editionlength  as int)), 20) + ')' AS 'SQL_server_Edition',
    substring (@sqlver, 6, 4) + ')' as 'SQL_SP (Bld.)'


     

    MohammedU.
    Microsoft SQL Server MVP
    Moderator
    SQL-Server-Performance.com

    All postings are provided “AS IS” with no warranties for accuracy.
Page 1 of 1 (11 items)
Active Topics   My Discussions    Unanswered Posts


© 2000 - 2007 vDerivatives Limited All Rights Reserved.