Results 1 to 4 of 4
  1. #1
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313

    Unanswered: how to determine server version programatically?

    I am aware you can do a "select @@version" but that returns a string which may or may not be able to be parsed reliably for the server version. For example on my server I get this back:

    "Adaptive Server Enterprise/15.0/EBF 12783 GA/P/NT (IX86)/Windows 2000/ase150/2158/32-bit/OPT/Fri Aug 19 18:42:50 2005"

    So I'd have to parse this string for the "15.0" part.

    Is there another property I can query for that returns the version in a more program-friendly format, such as an int32 or int64?

  2. #2
    Join Date
    Mar 2007
    Posts
    29
    Hi,
    In sybase version 15.0 you have two global variables to find the server version.

    Try
    @@version_number
    Returns the whole version of the current release of Adaptive Server as an integer

    @@version_as_integer
    Returns the number of the last upgrade version of the current release of Adaptive Server as an integer. For example, @@version_as_integer returns 12500 if you are running Adaptive Server version 12.5, 12.5.0.3, or 12.5.1.

    I hope this will be useful to you.

    Thanks,
    shiya

  3. #3
    Join Date
    Mar 2007
    Posts
    86
    Quote Originally Posted by jezemine
    I am aware you can do a "select @@version" but that returns a string which may or may not be able to be parsed reliably for the server version. For example on my server I get this back:

    "Adaptive Server Enterprise/15.0/EBF 12783 GA/P/NT (IX86)/Windows 2000/ase150/2158/32-bit/OPT/Fri Aug 19 18:42:50 2005"

    So I'd have to parse this string for the "15.0" part.

    Is there another property I can query for that returns the version in a more program-friendly format, such as an int32 or int64?

    you can always do this (on unix/linux or a unix emulator on win)
    dataserver -v|grep 'Adaptive Server'|tr -s '/' ' '|awk '{print $4}'

    that returns:
    15.0.1

  4. #4
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    thanks for the @@version_number tip, that's perfect.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •