开发者

How to change name of table while creating it through Stored procedure

I want to write a Stored procedure...which will create a ta开发者_JS百科ble with xyz name ...but when i call the SP for very second time it will give the error bcoz table already exist...I want to take table name as input..and want table to be created with that name... How to archive this..... Asp.net ---Mysql


delimiter //
CREATE PROCEDURE CreateTable (IN name VARCHAR(100))
BEGIN
  SET @q = CONCAT('CREATE TABLE ', name ,' (...)');
  PREPARE s FROM @q;
  EXECUTE s;
  DEALLOCATE PREPARE s;
END//
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜