General
| Semi-colon separated sentences | db2 -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 database | TERMINATE |
| 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 tables | LIST TABLES FOR SCHEMA myuser |
| Change current schema | SET CURRENT SCHEMA otherschema |
| Change the isolation level (RR, RS, CS, UR) | SET ISOLATION RR |
| List all tablespaces with their status | LIST TABLESPACES |
| Describe the structure of the table | DESCRIBE TABLE tbl1 |
| Describe the result of a query | DESCRIBE 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





