I'm trying to delete specific data from any tables in my SQL Server. DB like this. I want to delete all Romios.
Dog.table
(NAME,AGE) = {(Romio,2), (Juliet,3)}
Cat.table
(NAME, Fur) = {(Romio,short), (Trump, bald)}
Cow.table
(Name, Mlik) = {(Romio, 10L), (Obama, 2L)}
Useless.table
(Use1, Use2) = {...}
So, I got tables list with the below code:
SELECT TABLE_NAME FROM information_schema.COLUMNS where COLUMN_NAME = 'NAME'
But, the next step doesn't work.
DELETE (SELECT TABLE_NAME FROM information_schema.COLUMNS where COLUMN_NAME = 'NAME') WHERE Name = 'Romio'
Yeah..... I know delete query only works for 1 table. That query has a problem.
How can I make it work?