Useful MaxDB commands


To find a list of tables in a schema:

$ sqlcli -u TEST,TEST -d SYNCMANA "SELECT * FROM TABLES WHERE SCHEMANAME = 'TEST'"

To find a list of triggers on a table:

$ sqlcli -u DBSERVICE,SECRET -d SYNCMANA "SELECT * FROM TRIGGERS WHERE TABLENAME = 'T'"

To describe a table’s structure:

$ cat me && echo "-----" && \
   loadercli -d SYNCMANA -u TEST,TEST -b ./me && echo "-----" && \
   cat tabledef.txt
dataextract for dataload table T
outstream file 'tabledef.txt'
outstream file 'idontcare'

-----
Loader protocol: '/home/cjcollier/.sdb/loader/log/loader.prt'
Loader packages: '/home/cjcollier/sdb/loader/packages'

User TEST connected to database SYNCMANA schema TEST on local host.
dataextract for dataload table T
outstream file 'tabledef.txt'
outstream file 'idontcare'
Successfully executed

-----
//
CREATE TABLE "T"
(
        "I"  Integer  NOT NULL,
        "C"  Varchar (32) UNICODE,
        PRIMARY KEY ("I")
)
 NO FIXED LENGTH COLUMN
//
DATALOAD TABLE "T"
"I" 1 CHAR
"C" 2 CHAR DEFAULT NULL
INSTREAM  FILE  'idontcare'
 COMPRESSED UCS2
DECIMAL '//./'
SEPARATOR ','
DELIMITER '"'
DATE INTERNAL
TIME INTERNAL
TIMESTAMP INTERNAL
NULL '?                   '
BOOLEAN 'TRUE/FALSE'
//
, , ,

Leave a Reply