Link to home
Start Free TrialLog in
Avatar of FrancineTaylor
FrancineTaylor

asked on

How to perform an action on each of a list of tables

My company's database has over a hundred files which contain the column "CoreID".  I want to create a SP that will delete all records for a certain value of CoreID.

I'm guessing I should use a cursor, but I can't find a good example of exactly what I'm trying to do.  First, I have an SQL statement that will give me the names of all files which have the CoreID column.  For each of those files, I want to DELETE FROM <filename> WHERE CoreID = <some value>

What should my SQL look like?
ASKER CERTIFIED SOLUTION
Avatar of JestersGrind
JestersGrind
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of FrancineTaylor
FrancineTaylor

ASKER

Thanks, it was the creation and execution of the command that was the part I was missing.

I guess you can do it with a temp table or a cursor...