TheTyrant
asked on
All tables in database using DBI
Is there a way to get a list of all the tables withing a certain database?
for example, if i were to connect to a database named 'aaron' could i get a list of all the tables within 'aaron'?
thanks
for example, if i were to connect to a database named 'aaron' could i get a list of all the tables within 'aaron'?
thanks
ASKER
could you give me an example of how to use table_info properly? still fairly new with perl & the dbi package :/
im interfacing with multiple database server (so far only MS SQL, and MS Access, plus more later) and need to put a table selection list into a Tk app.
im interfacing with multiple database server (so far only MS SQL, and MS Access, plus more later) and need to put a table selection list into a Tk app.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks :)
the first example worked perfectly - 174 different tables in ms access db
the second example gave me this:
DBD::ODBC::db table_info failed: [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented (SQL-HYC00)
(DBD: st_tables/SQLTables err=-1) at C:\Cacoon\examples\odbc\tb llst.pl line 12.
Can't call method "fetchrow_hashref" on an undefined value at C:\Cacoon\examples\odbc\tb llst.pl line 13.
either way i should be able to figure it out from here now.
thanks a lot :)
the first example worked perfectly - 174 different tables in ms access db
the second example gave me this:
DBD::ODBC::db table_info failed: [Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented (SQL-HYC00)
(DBD: st_tables/SQLTables err=-1) at C:\Cacoon\examples\odbc\tb
Can't call method "fetchrow_hashref" on an undefined value at C:\Cacoon\examples\odbc\tb
either way i should be able to figure it out from here now.
thanks a lot :)
Specific databases also have specific ways to get the table names. MySql has 'SHOW TABLES' for instance, and "SELECT NAME FROM sysobjects where TYPE='u'" works on MS SQLServer.