I have a long script for deleting some specific data from a lot (more than 100+) of tables and it looks something like this:
...
Delete from Table_name WHERE Company not in ('Company1','Company2')
Delete from Table_name WHERE Company not in ('Company1','Company2')
Delete from Table_name WHERE Company not in ('Company1','Company2')
Delete from Table_name WHERE Company not in ('Company1','Company2')
...
I want to change this so I don't have to change the variables on every line, I want to be able to set a where statement in the beginning, and that will change all the delete lines
declare .....something something
SELECT CompanyID
FROM _Company
WHERE Company in ('Company1','Company2') -- I want to change this where statement only
Delete from Table_name WHERE Company not in (variable)
Delete from Table_name WHERE Company not in (variable)
Delete from Table_name WHERE Company not in (variable)
Delete from Table_name WHERE Company not in (variable)