SQL/MP Version Management Guide
Database Versions
Compaq NonStop™ SQL/MP Version Management Guide—429833-001
3-14
Retrieving Object Versions
As an example, suppose you are running version 310 SQLCI and want to retrieve the
version of the CUSTOMER table. You can type these commands:
>> VOLUME \SYS2.$VOL1.SALES;
>> GET VERSION OF TABLE CUSTOMER;
The response to this query is:
VERSION: 310
--- SQL operation complete.
For the syntax of the GET VERSION statement and for examples of using the statement
in static and dynamic SQL programs, see the NonStop SQL/MP Reference Manual and
the NonStop SQL/MP Programming Manual for the language you are using.
Using the Catalog Queries
If an object is registered in a catalog whose version is 300 or newer, you can retrieve the
object version from the appropriate catalog table: that is, from TABLES, INDEXES, or
CPRULES. (To determine which table to query for a particular object version, see the
table in Object Versions in Catalog Tables
on page 3-12.)
When your database is operating, avoid querying catalog tables for version information.
Catalog table queries can result in contention for catalog tables, possibly degrading
performance. When a database is active, a better alternative is to execute the GET
VERSION statement.
If you do query catalog tables and want your queries to work on newer versions of the
catalogs, be sure to specify the column names explicitly; do not use SELECT * as your
query statement.
Using the SQLGETOBJECTVERSION Procedure
SQLGETOBJECTVERSION is a TAL procedure you can call from a program to
retrieve the version of a table, an index, a view, or a collation. You can call the
SQLGETOBJECTVERSION procedure from version 2 SQL programs in addition to
version 300 and newer programs. The procedure is not available to version 1 programs,
and will be phased out in a future release of SQL/MP software. Therefore, use the GET
VERSION statement instead in software designed to be compatible with version 300
and newer SQL/MP software.
For information on developing programs that are version independent, see Section 7,
Version Compatibility for SQL Programs.
Using the SQL FILEINFO Utility
You can execute the FILEINFO utility command to retrieve the versions of tables,
views, indexes, and collations whose versions are the same as or older than the version
of the SQL/MP software on the node where you issue the command. When you execute
the DETAIL option with the FILEINFO command to obtain information about a
particular object, the command returns version information.