Withdata Software provide some ETL (Extract-Transform-Load) tools for DB2: FileToDB Load TXT, CSV, TSV, XML, JSON, Excel, SQL, RDF, INI data to DB2 DBToFile Export DB2 data to TXT, CSV, TSV, XML, JSON, Excel, SQL files DBCopier Copy data between DB2 and other rational databases ... Read more
Category Archives: DB2
How to get index column names of a table from DB2
select name,colnames from sysibm.sysindexes where tbname='my_table_name' See also: How to get index column names of a table from SQL Server How to get index column names of a table from MySQL How to get index column names of a table from PostgreSQL How to get index column names of a table from ... Read more
How to get primary key of a table from DB2
SELECT COLNAME FROM syscat.COLUMNS WHERE tabschema='my_schema_name' AND tabname='my_table_name' AND KEYSEQ=1 See also: How to get primary key of a table from PostgreSQL How to get primary key of a table from SQLite How to get primary key of a table from MySQL How to get primary key of a table ... Read more
About DB2 error “CLI0106E Connection is closed. SQLSTATE=08003”
Sometimes, you meet this error “”CLI0106E Connection is closed. SQLSTATE=08003” when you run DB2 tools. This error would be due to “The connection specified by the connection handle is no longer active.” You can add the following to your db2cli.ini file and restart the ... Read more
About “Cannot load client library: db2cli.dll”
When you use DB2 tools that call DB2 client library “db2cli.dll”, you may meet this error: “Cannot load client library: db2cli.dll” You can download this tool to solve the problem: DB2_CLI_Setup_32.zip ... Read more
About “Cannot load client library: db2cli64.dll”
When you use DB2 tools that call DB2 client library “db2cli64.dll”, you may meet this error: “Cannot load client library: db2cli64.dll” You can download this tool to solve the problem: DB2_CLI_Setup_64.zip ... Read more
How to execute sql file via command line for DB2
You can save a .sql file to your hard drive, and execute it using the DB2 command line using: db2 -vtf C:\path\to\test.sql -v echoes the command text back to the command line -t sets the statement terminator to ;. -f tells the command line to load the commands from the file. See other command ... Read more
The DB2 equivalent for the MySQL Limit
In MySQL, you can use “Limit n,m”, like this: select * from sometable order by name limit 20,10 And in DB2, use this query: SELECT * FROM (SELECT * FROM sometable ORDER BY name DESC fetch first {start} rows only ) AS mini ORDER BY mini.name ASC fetch first {total} rows ... Read more
Replace (Update/Insert) a row into DB2 table – Merge into
In MySQL, if you want to either updates or inserts a row in a table, depending if the table already has a row that matches the data, you can use “ON DUPLICATE KEY UPDATE”. How to do it in DB2? Use “merge into” . MERGE INTO table_to_upsert AS tab USING (VALUES ... Read more
How to get column names from DB2 table
SELECT colname, typename, length, scale, default FROM syscat.columns WHERE tabname = “<table name>” AND tabschema = “<schema name>” See also: How to get column names from Sql Server table How to get column names from Oracle table How to get column names from ... Read more