SQL/MP Installation and Management Guide

Querying SQL/MP Catalogs
HP NonStop SQL/MP Installation and Management Guide523353-004
6-9
Displaying Information About Partitions
This TACL macro displays the keys and indexes of a table:
?TACL MACRO
#FRAME
#PUSH #INLINEECHO, #INLINEPREFIX
#SET #INLINEECHO -1
#SET #INLINEPREFIX //
#PUSH tname
#SET tname [#SHIFTSTRING /UP/ %1%]
$SYSTEM.SYSTEM.SQLCI /INLINE/
// VOLUME %2%;
//
// -- Report on the different keys and indexes of a table:
//
// SELECT I.TABLENAME, KEYTAG, KEYSEQNUMBER, COLNAME, ORDERING
// FROM COLUMNS C, KEYS K, INDEXES I
// WHERE C.TABLENAME = I.TABLENAME AND
// I.INDEXNAME = K.INDEXNAME AND
// I.TABLENAME LIKE "%%[tname]%%" AND
// K.TABLECOLNUMBER = C.COLNUMBER
// ORDER BY I.TABLENAME, KEYTAG, KEYSEQNUMBER
// ;
// EXIT;
#UNFRAME
For more information about TACL macros and how to write them, see the TACL
Reference Manual.
This example displays attribute information for the index XORDCUS. The query uses
the LIKE predicate with the wild-card character % to indicate that a string of 0, 1, or
more characters is acceptable in each wild-card position for a qualifying file name.
>> VOLUME \SYS1.$VOL1.SALES;
>> SELECT * FROM FILES
+> WHERE FILENAME LIKE "%XORDCUS%";
Displaying Information About Partitions
Information about partitions appears in the PARTNS catalog table. Your first query
about partitions should determine whether the object has partitions.
To obtain information on partitions, query the FILES table to determine whether the
partitions flag is set for the object. If PARTITIONED is Y, the object has partitions; if
PARTITIONED is N, the object is not partitioned.
This example displays the PARTITIONED column value for the PARTLOC table:
>> VOLUME \SYS1.$VOL1.INVENT;
>> SELECT FILENAME, PARTITIONED
+> FROM FILES
+> WHERE FILENAME = "\SYS1.$VOL1.INVENT.PARTLOC";