I have to reproduce the following code about 10 times. Where 'Distributor_001' should be a variable. Is this possible? I am able to use the variable as a column name, but not as a part of the table structure.
DELETE FROM [MyDB].[inbound].[Distributor_001]
WHERE [UPC] IN
(
SELECT UPC
FROM [MyDB].[inbound].[Distributor_001]
GROUP BY UPC
HAVING COUNT(UPC) > 1
)