var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Create table in stored procedure
How can I create table in stored procedure but pass the name of table as parameter?
you would do it with DECLARE, PREPARE, and EXECUTE statements
are you sure you are in the right forum?
can I do this?
CREATE PROCEDURE `CreateTable`(in TableName varchar(63))
DECLARE tn, s varchar(63);
SET @tn = TableName;
SET @S = 'CREATE TABLE ? (
`time` datetime NOT NULL default ''0000-00-00 00:00:00'',
`value` double NOT NULL default ''0'',
KEY `time` (`time`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1';
PREPARE stmt FROM @S;
EXECUTE stmt USING @tn;
DEALLOCATE PREPARE stmt;
i dunno, i don't have version 5
what happens when you execute that procedure?
can't execute it!
"You have an error in your SQL syntax..."
Is there someone who can write to me an example that works? The main is that I want to create table in stored procedure but pass the table name via param.
(I'm using MySQL 5.0.0 alpha)