Hi Expert,
I am new at sql so go easy. : )
I have 2118 tables I need to update with a new column name of "SECTOR". In each new Sector column I need to fill down all the blanks with the same value.
I can accomplish this separately by running the following commands one at a time.
Is there any way to run all these commands at one time?
ALTER TABLE [Sector_Power_CV300A] ADD SECTOR VARCHAR(50);
ALTER TABLE [Sector_Power_CV300B] ADD SECTOR VARCHAR(50);
ALTER TABLE [Sector_Power_CV300C] ADD SECTOR VARCHAR(50);
UPDATE [Sector_Power_CV300A] SET Sector_Power_CV300A].SECTOR= ''CV300A''
UPDATE [Sector_Power_CV300B] SET Sector_Power_CV300B].SECTOR= ''CV300B''
UPDATE [Sector_Power_CV300C] SET Sector_Power_CV300C].SECTOR= ''CV300C''
Once again thank you for your help!
RH
I am new at sql so go easy. : )
I have 2118 tables I need to update with a new column name of "SECTOR". In each new Sector column I need to fill down all the blanks with the same value.
I can accomplish this separately by running the following commands one at a time.
Is there any way to run all these commands at one time?
ALTER TABLE [Sector_Power_CV300A] ADD SECTOR VARCHAR(50);
ALTER TABLE [Sector_Power_CV300B] ADD SECTOR VARCHAR(50);
ALTER TABLE [Sector_Power_CV300C] ADD SECTOR VARCHAR(50);
UPDATE [Sector_Power_CV300A] SET Sector_Power_CV300A].SECTOR= ''CV300A''
UPDATE [Sector_Power_CV300B] SET Sector_Power_CV300B].SECTOR= ''CV300B''
UPDATE [Sector_Power_CV300C] SET Sector_Power_CV300C].SECTOR= ''CV300C''
Once again thank you for your help!
RH