This article shows the query to obtain the history of DB2 versions and patching. That is, not only shows the current version, but since when is installed / updated.

select versionnumber, version_timestamp

from sysibm.sysversions

 

The result of the query shows the version history / patch installation:

VERSIONNUMBER VERSION_TIMESTAMP
------------- --------------------------
9050000 2009-09-18-13.06.42.998615
9050300 2010-03-21-21.58.42.326805
9070300 2011-03-07-09.21.03.802135

Another methods to know the version and patch level of current DB2 installation is to use the utility “db2level” or by using another query over the DB2 catalog.

db2level utility: It provides information on the general characteristics of the installation DB2 (DB2 software path, version, patch,…)

DB21085I  Instance "db2test" uses "64" bits and DB2 code release "SQL09054" with level identifier "06050103".
Informational tokens are "DB2 <strong><em>v9.5.0.4</em></strong>", "special_21925", "U825478_21925", and Fix Pack "4".
Product is installed at "/db2/db2test/db2_software"

 

The same information, with a query over the database catalog is:

SELECT *
FROM TABLE (sysproc.env_get_inst_info()) as INSTANCEINFO