From: Martijn Tonies Date: February 9 2006 1:55pm Subject: Re: Passing db names to a stored proc in MySQL 5 List-Archive: http://lists.mysql.com/mysql/194721 Message-Id: <11ed01c62d80$7921cd40$cd02a8c0@martijnws> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit > I have tried dynamically assigning a database name to a stored proc via > its parameter list: > > CREATE STORED PROCEDURE testStoredProc (IN test_db_name CHAR) > BEGIN > SELECT * FROM test_db_name.test_table; > END; > > MySQL does not resolve test_db_name to the value passed in the > parameter, and the query fails because there is no database with that name. > > Is there any way around this? No. Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL Server Upscene Productions http://www.upscene.com Database development questions? Check the forum! http://www.databasedevelopmentforum.com