Apr 24, 2002 #1 Thorsten3 Programmer Jan 28, 2001 22 JP I just learned how to create an index and how to drop an index. Is there a way to list or view indexes?
I just learned how to create an index and how to drop an index. Is there a way to list or view indexes?
Apr 25, 2002 #2 Tim1 Programmer Mar 27, 2001 242 GB Hiya, Depending on which RDBMS you are using, there is a system table that holds the information. In Sybase/SQL server, the syntax is SELECT name FROM sysindexes This will list ALL indexes in a database. If you want to restrict it to one table use : SELECT name FROM sysindexes WHERE id=OBJECT_ID('table_name') HTH Tim Upvote 0 Downvote
Hiya, Depending on which RDBMS you are using, there is a system table that holds the information. In Sybase/SQL server, the syntax is SELECT name FROM sysindexes This will list ALL indexes in a database. If you want to restrict it to one table use : SELECT name FROM sysindexes WHERE id=OBJECT_ID('table_name') HTH Tim
Apr 25, 2002 #3 crufty Programmer Nov 12, 2001 32 US In Oracle: select * from ind; This will list all indeces and a ton of information about each index. Upvote 0 Downvote
Apr 25, 2002 Thread starter #4 Thorsten3 Programmer Jan 28, 2001 22 JP Thanks a lot! Unfortunatly I use DB2 and both comands didn't work. Upvote 0 Downvote
Apr 28, 2002 #5 karluk MIS Nov 29, 1999 2,485 US It's been a long time since I've worked with DB2, but as I recall the catalog table is sysibm.sysindexes. Please check if that works. If not you may want to post your question in forum178, which is specific to DB2. Upvote 0 Downvote
It's been a long time since I've worked with DB2, but as I recall the catalog table is sysibm.sysindexes. Please check if that works. If not you may want to post your question in forum178, which is specific to DB2.
Apr 29, 2002 #6 PruSQLer Technical User Nov 6, 2001 221 US Good recall Karluk! The table is indeed sysibm.sysindexes. Upvote 0 Downvote
May 6, 2002 Thread starter #7 Thorsten3 Programmer Jan 28, 2001 22 JP Thanks, it worked! describe select * from sysibm.sysindexes select NAME,CREATOR, TBNAME, COLNAMES from sysibm.sysindexes sorry I didn't know about the DB2 forum Upvote 0 Downvote
Thanks, it worked! describe select * from sysibm.sysindexes select NAME,CREATOR, TBNAME, COLNAMES from sysibm.sysindexes sorry I didn't know about the DB2 forum