Re: Determining if a table exists

2005-05-03 Thread Dusan Kolesar
On Mon, 02 May 2005 19:56:49 +0200, Eric Bergen [EMAIL PROTECTED]  
wrote:

The column name is Tables_in_mysql. show syntax doesn't support order  
by. Information_schema tables in 5.0 do because they use the normal  
select syntax.

-Eric
Jim McAtee wrote:
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:

jst998_foo
jst998_bar
jst999_foo
jst999_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.



Hello,
What about:
SELECT * FROM `information_schema`.`TABLES`
  where TABLE_SCHEMA = 'databaseName' AND TABLE_TYPE = 'BASE TABLE' AND  
TABLE_NAME LIKE 'jst%'

--
Dusan Kolesar
Helsinska 19
040 13  Kosice
Slovakia
e-mail : [EMAIL PROTECTED]
ICQ# : 160507424
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Determining if a table exists

2005-05-02 Thread Jim McAtee
We're running an application that creates table names in a numeric 
sequence.  For example:

jst998_foo
jst998_bar
jst999_foo
jst999_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]


Re: Determining if a table exists

2005-05-02 Thread Eric Bergen
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:

jst998_foo
jst998_bar
jst999_foo
jst999_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]


Re: Determining if a table exists

2005-05-02 Thread Jim McAtee
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:

jst998_foo
jst998_bar
jst999_foo
jst999_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]


Re: Determining if a table exists

2005-05-02 Thread Eric Bergen
The column name is Tables_in_mysql. show syntax doesn't support order 
by. Information_schema tables in 5.0 do because they use the normal 
select syntax.

-Eric
Jim McAtee wrote:
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:

jst998_foo
jst998_bar
jst999_foo
jst999_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]