Hey, thanks.

show tables like 'jst%_foo'

looks like it would work just fine.  Two questions:

What is the column name returned and can I do an ORDER BY? If so, then I can just check the first and last rows in the results to determine the numeric range.

My bad - server version is 3.23.x. Dictated by this (old as alabama) application. They refuse to support newer versions of MySQL.


----- Original Message ----- From: "Eric Bergen" <[EMAIL PROTECTED]>
To: "Jim McAtee" <[EMAIL PROTECTED]>
Cc: <mysql@lists.mysql.com>
Sent: Monday, May 02, 2005 11:31 AM
Subject: Re: Determining if a table exists



I don't remember what commands are available in 3.21 but try these

show tables like 'table_name';
then check mysql_num_rows on the result.

describe table;
check mysql_num_rows

show tables;
then pick out the table name;

3.21 is old as alabama (forrest gump) it's time for an upgrade :)


Jim McAtee wrote:

We're running an application that creates table names in a numeric sequence. For example:

jst0000998_foo
jst0000998_bar
jst0000999_foo
jst0000999_bar
jst0001000_foo
jst0001000_bar
jst0001001_foo
jst0001001_bar

I need to write a maintenance app that first needs to determine the numeric range of existing tables. In the above example it would be 998 to 1001.

What would be a half-way efficient way of doing this?

MySQL version is 3.21.x, with MyISAM tables.




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to