SQL/MP Installation and Management Guide

Querying SQL/MP Catalogs
HP NonStop SQL/MP Installation and Management Guide523353-004
6-7
Displaying Information About Columns
This example displays CPRLSRCE information about a collation:
>> VOLUME \SYS1.$VOL1.SALES;
>> SELECT * FROM CPRLSRCE
+> WHERE CPRULESNAME LIKE "%FRENCH%";
Displaying Information About Columns
Information about columns appears in the COLUMNS catalog table and includes the
data type definitions.
You can query the COLUMNS table for information about particular column definitions,
or you can obtain a list of columns for a specific table. You might also query the
COLUMNS table to check the definitions of columns whose definitions must match.
This example displays all column names for a table and the data type definitions:
>> VOLUME \SYS1.$VOL1.SALES;
>> SELECT COLNAME, DATATYPE, COLSIZE, SCALE
+> FROM COLUMNS
+> WHERE TABLENAME = "\SYS1.$VOL1.SALES.ORDERS";
This example displays all tables in which the column PRICE is found and includes the
data definitions of the columns:
>> VOLUME \SYS1.$VOL1.SALES;
>> SELECT COLNAME, TABLENAME, DATATYPE, COLSIZE, SCALE,
+> PRECISION, PICTURETEXT, CHARACTERSET
+> FROM COLUMNS
+> WHERE COLNAME = "PRICE";
Displaying Comments and Help Text
Comments specified for an object are located in the COMMENTS catalog table. You
can query this table to display the comments.
This example selects all the comments on the table CUSTOMER:
>> VOLUME \SYS1.$VOL1.SALES;
>> SELECT * FROM COMMENTS
+> WHERE OBJNAME = "\SYS1.$VOL1.SALES.CUSTOMER";
This example selects all the comments on all the constraints defined for the table
CUSTOMER. Constraints are denoted by the value “CN” in the OBJTYPE column of
the COMMENTS table.
>> VOLUME \SYS1.$VOL1.SALES;
>> SELECT * FROM COMMENTS
+> WHERE OBJNAME = "\SYS1.$VOL1.SALES.CUSTOMER" AND
+> OBJTYPE = "CN";
The COMMENTS catalog table also records help text for columns. You can query this
table to display the help text. The OBJSUBNAM column of the COMMENTS table
contains column names, and the OBJTYPE column contains “HC” to denote help text.