I am trying to drop some columns from all tables in a database. I can generate multiple scripts on all databases (see below) but how can I now execute them automatically without copying and pasting and executing the generated script multiple times? AND the second issue will be dropping any default constraints. Anyone have a script that can do both? thanks.
EDIT: Corrected script which no longer gives me constraint error
EXEC sp_MSforeachdb 'USE ? Select ''USE ? ALTER TABLE [dbo].[''+TABLE_NAME +''] DROP COLUMN ''+COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME Like ''myField[3-9]%'' '