WebNov 19, 2008 · DB2 逆引きWiki - 索引の一覧を確認するにはより。 SYSCAT.INDEXESテーブルを直接参照すればよいらしい。 -- テスト用テーブル CREATE TABLE test ( id … WebApr 19, 2015 · As far as getting the "primary key" information, you probably want to know which index is the "clustering" index (which is what usually, but not always, determines …
DB2で個人的によく使うコマンド - Qiita
WebOct 5, 2024 · Query. select tab.tabschema as schema_name, const.constname as pk_name, listagg (key.colname, ', ') within group ( order by key.colseq) as columns , tab.tabname as table_name from … WebOct 3, 2024 · Sorted by: 3. If you are using Db2 for i-Series (formerly AS/400) as suggested by the db2-400 tag you put on the question, check the catalog QSYS2.SYSCST - it has a column CONSTRAINT_TYPE whose value is 'P' for primary key. You may need to join with other catalog objects (exammple QSYS2.SYSTABLES, QSYS2.SYSCOLUMNS) … driveways berkshire
Get the list of primary keys and corresponding table name
WebMar 1, 2013 · Adding existing column as primary key in DB2 with existing primary keys. PRODUCT_ID ADDED_DT PRODUCT_NAME PRODUCT_COLOR PRODUCT_PRICE EXPIRY_DT. I want to add EXPIRY_DT as primary key such that the table will now have three primary keys viz. PRODUCT_ID, ADDED_DT and EXPIRY_DT. ALTER TABLE … WebAug 22, 2011 · Oct 25, 2011 at 12:09. Add a comment. 0. This is probably the easiest option, since a primary key is supported by a matching index: select COLNAMES from SYSIBM.SYSINDEXES where tbname = 'TABLE' and uniquerule = 'P'; You can also query the columns catalog table: select NAME from SYSIBM.SYSCOLUMNS where tbname = … WebDec 16, 2011 · DB2 doesn't create clustered index for a PK by default. Primary keys. A primary key is a special type of unique key and cannot contain null values. For example, the DEPTNO column in the DEPT table is a primary key. A table can have no more than one primary key. Primary keys are optional and can be defined in CREATE TABLE or … driveways bicester