homiee Posted April 24, 2008 Share Posted April 24, 2008 Hey,Assuming I have a stored procedure:CREATE DEFINER=`localhost`@`%` PROCEDURE `sp_find_route`(IN a_start_point int, IN a_end_point int)BEGIN CREATE TABLE tableName ( level INT, route VARCHAR(255), owneruserid int, frienduserid int);Assuming I want that each time the SP is called tableName will change to a random 6 digits / characters name, is it possible?Thanks in advance,homiee Link to comment Share on other sites More sharing options...
justsomeguy Posted April 24, 2008 Share Posted April 24, 2008 You can probably use a random number function to create a random number and use that. You could also use a temporary table instead of a normal table. Link to comment Share on other sites More sharing options...
homiee Posted April 25, 2008 Author Share Posted April 25, 2008 Yeah but still how do I use that random number?I've triedDECLARE randomTableName VARCHAR(10);SET randomTableName ="aSdzXdsaS";CREATE TABLE randomTableName (...)but still it creates a table called randomTableName ... Link to comment Share on other sites More sharing options...
justsomeguy Posted April 28, 2008 Share Posted April 28, 2008 DECLARE @randomTableName VARCHAR(10);SET @randomTableName ="aSdzXdsaS";CREATE TABLE @randomTableName (...) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.