At 8:12 -0400 5/28/05, Jason Dixon wrote:
I'm trying to rename some tables for archival, but the table
renaming is failing when I use CONCAT() to form the table string
name:
CONCAT() produces a string, not an identifier.
mysql> RENAME TABLE flows TO flows_tmp, flows_new TO flows,
flows_tmp TO CONCAT("flows_", DATE_SUB(CURDATE(), interval 1 day));
ERROR 1064: You have an error in your SQL syntax near
'CONCAT("flows_", DATE_SUB(CURDATE(), interval 1 day))' at line 1
If I run the CONCAT() command by itself, everything works as expected:
+--------------------------------------------------------+
| CONCAT("flows_", DATE_SUB(CURDATE(), interval 1 day)) |
+--------------------------------------------------------+
| flows_2005-05-27 |
+--------------------------------------------------------+
1 row in set (0.00 sec)
Is there some magic pixie dust I need to throw around the CONCAT()
to have it interpolate into the RENAME TABLE command correctly?
This is on mysql-server 3.23.58 on a RHEL 3 clone.
--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]