How to recreate table in MYSQL?

2.4k views Asked by At

I am sorry for my bad English. Okay? my problem is i need to recreate temporary table many times (more then 5). I need totally change structure of table. I try do it like this but i have errors

CREATE TABLE  #DeletedData (RoleName varchar(max),  [Description] varchar(max))
....
IF OBJECT_ID('tempdb..#DeletedData') IS NOT NULL DROP TABLE #DeletedData
CREATE TABLE  #DeletedData (RoleName varchar(max),  DependentRoleName varchar(max))
1

There are 1 answers

0
nbk On

IN mysql you would do

CREATE TABLE  `#DeletedData` (RoleName LONGTEXT,  Description LONGTEXT);
DROP TABLE IF EXISTS `#DeletedData`;     
CREATE TABLE  `#DeletedData` (RoleName LONGTEXT,  DependentRoleName LONGTEXT);

Your code works in SQL server, so there is no need to change anything