Can we use variable and temporary tables in MySQL data flow ? Something similar to storeprocedure?

Reply
Highlighted
Visitor

Can we use variable and temporary tables in MySQL data flow ? Something similar to storeprocedure?

Here is the problem that i am currently facing.

I need to Alter table column name at run time dynamically being based on some dataset mapping. Is there a way I could use variable, temporary table or store procedure in MySQL Data Flow so that i can create a dynamic ALTER statement and execute it? 

Following is what I am trying to get done. 

Declare @sql VARCHAR(MAX) 

DECLARE @sql1 varchar(max) 

declare @columnname varchar(400) = 'columnName1'

SET @sql = 'alter table tablename rename column "oldcolname" to "

'+ @columnname +'"'

EXEC(@sql)

Tags (1)

Accepted Solutions
Visitor

Re: Can we use variable and temporary tables in MySQL data flow ? Something similar to storeprocedur


All Replies
Visitor

Re: Can we use variable and temporary tables in MySQL data flow ? Something similar to storeprocedur

Trying to achieve something like this using domo MySQL - Dataflow

SELECT @select:='SELECT * FROM '
SELECT @table:='`table_name`'
SELECT @sql:= CONCAT(@select,@table)
PREPARE dynamic_statement FROM @sql;
EXECUTE dynamic_statement;
DEALLOCATE PREPARE dynamic_statement;

Visitor

Re: Can we use variable and temporary tables in MySQL data flow ? Something similar to storeprocedur

Announcements
Dojo Day is Coming! Mark your calendars for May 30th 0900-1700 MST Click here for more information