Shoutbox

SQl querys: getting table names - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: SQl querys: getting table names (/showthread.php?tid=66779)

SQl querys: getting table names by MeEtc on 09-29-2006 at 03:51 PM

I am trying to figure out what tables are available on a particular database. I have read access to the whole database, through an html form to input queries. Is it possible to query a list of available tables?

code:
example: Select * from BaseTable.Table where ....
I have BaseTable, I am trying to figure out all of the Table names
RE: SQL querys: getting table names by WDZ on 09-29-2006 at 04:12 PM

SHOW TABLES FROM DatabaseName

(That works in MySQL, anyway)


RE: SQl querys: getting table names by MeEtc on 09-29-2006 at 04:15 PM

Error: your query must have a select statement.

there's a error detect in place, ya need a select and where clause


RE: SQL queries: getting table names by WDZ on 09-29-2006 at 04:19 PM

Well, I dunno if it's possible to list the tables if you can only run SELECT queries... hmm... :-/


RE: SQl querys: getting table names by Adeptus on 09-29-2006 at 05:00 PM

What is the database (e.g. MySQL, MS SQL) and what are you using to query it with?

Using MS SQL, you can select the table names from sysobjects system table -- I would have to look in the docs to see what you need in your where clause to limit the results to just tables (and not also views, etc).


RE: SQl querys: getting table names by MeEtc on 09-29-2006 at 05:12 PM

its MySQL on a java/tomcat server


RE: SQl querys: getting table names by Adeptus on 09-29-2006 at 05:18 PM

http://dev.mysql.com/doc/refman/5.0/en/information-schema.html

Unfortunately, with MySQL 4.x and older, you are out of luck if you can't use SHOW.


RE: SQl querys: getting table names by MeEtc on 10-19-2006 at 05:24 PM

sorry to bring back a thread....

is it possible to embed this as a subquery? I tried
select * from (show tables from database where table is not null) where table is not null
but that gives a "no 'where' clause found" error