티스토리 뷰

공부

[mysql] use variables in query

승가비 2023. 8. 19. 23:48
728x90
SET @query = CONCAT('ALTER TABLE ', var_referenced_table_name, ' DROP FOREIGN KEY ', var_constraint_name, ';');
PREPARE stmt FROM @query; 
EXECUTE stmt; 
DEALLOCATE PREPARE stmt;

https://stackoverflow.com/questions/11687803/mysql-variables-in-alter-table-script

 

MySQL variables in ALTER TABLE script

Hello The following procedure will have to move all constraints from one table to the other however I am having some difficulties at the point where the constraint should be deleted. The problem: ...

stackoverflow.com

 

728x90
댓글