General

Semi-colon separated sentencesdb2 -t
At sign-separated sentences (when there is SQL PL code)db2 -td@
Define a terminator character--#SET TERMINATOR @
List all databases (aliases)LIST DB DIRECTORY
Connect to a database (alias)CONNECT TO mydb
Disconnect from a databaseTERMINATE
Get the current timestamp from the environment (registry values).VALUES CURRENT TIMESTAMP
Get the current user from the environment (registry values).VALUES CURRENT USER
Get the current database from the environment (registry values).VALUES CURRENT SERVER
List all tablesLIST TABLES FOR SCHEMA myuser
Change current schemaSET CURRENT SCHEMA otherschema
Change the isolation level (RR, RS, CS, UR)SET ISOLATION RR
List all tablespaces with their statusLIST TABLESPACES
Describe the structure of the tableDESCRIBE TABLE tbl1
Describe the result of a queryDESCRIBE SELECT * FROM tbl1
Get help for a Db2 command? command
Get help for a SQL code (SQLXXXX)? SQLXXXX
Get help for a SQLstate (YYYYY)? YYYYY
Comments