Re: How to determine if temporary table exists
At 12:00 AM 11/21/2008, you wrote: In the last episode (Nov 20), mos said: At 08:02 PM 11/20/2008, you wrote: Try drop table if exists Tablex; Ahhh, I don't necessarily want to drop the table if it already exists. :) If the table already exists then I'll add new rows to it (and keep the existing rows). If the table doesn't exist, then I'll create it. I suppose could count the rows in Tablex and it would throw an exception if the table did not exist . But I really didn't want to resort to trapping an exception in my program. I thought there should be an easy way using SQL to determine if a temporary table exists or not. Why not CREATE TEMPORARY TABLE IF NOT EXISTS ...? If you really need to know whether the table existed before or not, that command will return a warning if it was there already. http://dev.mysql.com/doc/refman/5.0/en/create-table.html Dan, That will work. :-) Thanks. Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
How to determine if temporary table exists
How can I determine if a temporary table exists? Normally I use something like: create temporary table Tablex like Table1; show tables like Tablex; but the Show Tables never displays any rows for a temporary table even though the temporary Tablex exists. (All in same thread). So is there a better way to determine if a temporary table exists? TIA Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: How to determine if temporary table exists
Try drop table if exists Tablex; On Fri, Nov 21, 2008 at 9:53 AM, mos [EMAIL PROTECTED] wrote: How can I determine if a temporary table exists? Normally I use something like: create temporary table Tablex like Table1; show tables like Tablex; but the Show Tables never displays any rows for a temporary table even though the temporary Tablex exists. (All in same thread). So is there a better way to determine if a temporary table exists? TIA Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- I'm a MySQL DBA in china. More about me just visit here: http://yueliangdao0608.cublog.cn
Re: How to determine if temporary table exists
At 08:02 PM 11/20/2008, you wrote: Try drop table if exists Tablex; Ahhh, I don't necessarily want to drop the table if it already exists. :) If the table already exists then I'll add new rows to it (and keep the existing rows). If the table doesn't exist, then I'll create it. I suppose could count the rows in Tablex and it would throw an exception if the table did not exist . But I really didn't want to resort to trapping an exception in my program. I thought there should be an easy way using SQL to determine if a temporary table exists or not. Mike On Fri, Nov 21, 2008 at 9:53 AM, mos mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: How can I determine if a temporary table exists? Normally I use something like: create temporary table Tablex like Table1; show tables like Tablex; but the Show Tables never displays any rows for a temporary table even though the temporary Tablex exists. (All in same thread). So is there a better way to determine if a temporary table exists? TIA Mike -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysqlhttp://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]http://lists.mysql.com/[EMAIL PROTECTED] -- I'm a MySQL DBA in china. More about me just visit here: http://yueliangdao0608.cublog.cnhttp://yueliangdao0608.cublog.cn -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: How to determine if temporary table exists
In the last episode (Nov 20), mos said: At 08:02 PM 11/20/2008, you wrote: Try drop table if exists Tablex; Ahhh, I don't necessarily want to drop the table if it already exists. :) If the table already exists then I'll add new rows to it (and keep the existing rows). If the table doesn't exist, then I'll create it. I suppose could count the rows in Tablex and it would throw an exception if the table did not exist . But I really didn't want to resort to trapping an exception in my program. I thought there should be an easy way using SQL to determine if a temporary table exists or not. Why not CREATE TEMPORARY TABLE IF NOT EXISTS ...? If you really need to know whether the table existed before or not, that command will return a warning if it was there already. http://dev.mysql.com/doc/refman/5.0/en/create-table.html -- Dan Nelson [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]