Mysql – How to drop foreign key using a subselect?
First off, we're using MySQL 5. I'd like to do something like the following: SET @fkcn = (SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = (SELECT DATABASE()) AND REFERENCED_TABLE_NAME = "ProviderOrder"); ALTER TABLE AuditProviderOrder DROP FOREIGN KEY @fkcn, DROP COLUMN ProviderOrderID;…