If you need to create a batch select or update or delete statement list, use the following sql, which queries the sys.tables in ms sql server.
0 1 2 3 4 5 |
SELECT 'DELETE from ' + t.name + ' WHERE account not like ''TEST%''' AS table_name FROM sys.tables AS t WHERE t.name like 's_account%' order by 1 |
0 1 2 3 4 5 6 |
SELECT 'SELECT * from ' + t.name + ' WHERE account not like ''TEST%''' AS table_name FROM sys.tables AS t WHERE t.name like 'dim_account%' AND t.name not like '%old' order by 1 |