{"id":5454,"date":"2016-10-24T04:53:43","date_gmt":"2016-10-24T04:53:43","guid":{"rendered":"http:\/\/www.withdata.com\/blog\/?p=5454"},"modified":"2017-04-20T11:08:23","modified_gmt":"2017-04-20T11:08:23","slug":"how-to-get-primary-key-of-a-table-from-db2","status":"publish","type":"post","link":"https:\/\/www.withdata.com\/blog\/db2\/how-to-get-primary-key-of-a-table-from-db2.html","title":{"rendered":"How to get primary key of a table from DB2"},"content":{"rendered":"<p><code>SELECT COLNAME<br \/>\nFROM syscat.COLUMNS<br \/>\nWHERE tabschema='my_schema_name'<br \/>\nAND tabname='my_table_name'<br \/>\nAND KEYSEQ=1<\/code><\/p>\n<p>See also:<\/p>\n<p><a href=\"http:\/\/www.withdata.com\/blog\/postgresql\/how-to-get-primary-key-of-a-table-from-postgresql.html\">How to get primary key of a table from PostgreSQL<\/a><\/p>\n<p><a href=\"http:\/\/www.withdata.com\/blog\/sqlite\/how-to-get-primary-key-of-a-table-from-sqlite.html\">How to get primary key of a table from SQLite<\/a><\/p>\n<p><a href=\"http:\/\/www.withdata.com\/blog\/mysql\/how-to-get-primary-key-of-a-table-from-mysql.html\">How to get primary key of a table from MySQL<\/a><\/p>\n<p><a href=\"http:\/\/www.withdata.com\/blog\/sql-server\/how-to-get-primary-key-of-a-table-from-sql-server.html\">How to get primary key of a table from SQL Server<\/a><\/p>\n<p><a href=\"http:\/\/www.withdata.com\/blog\/oracle\/how-to-get-primary-key-of-a-table-from-oracle.html\">How to get primary key of a table from Oracle<\/a><\/p>\n<p>Some DB2 tools you can try: <a href=\"https:\/\/www.withdata.com\/db2\/\"> https:\/\/www.withdata.com\/db2\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SELECT COLNAME FROM syscat.COLUMNS WHERE tabschema=&#8217;my_schema_name&#8217; AND tabname=&#8217;my_table_name&#8217; 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 from SQL Server How to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[1318,1719],"class_list":["post-5454","post","type-post","status-publish","format-standard","hentry","category-db2","tag-db2","tag-get-primary-key"],"_links":{"self":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/5454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/comments?post=5454"}],"version-history":[{"count":4,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/5454\/revisions"}],"predecessor-version":[{"id":6457,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/posts\/5454\/revisions\/6457"}],"wp:attachment":[{"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/media?parent=5454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/categories?post=5454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.withdata.com\/blog\/wp-json\/wp\/v2\/tags?post=5454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}