I have dynamic databases being added everyday to my system.
the name always follows this pattern:
NAME_YYYYMMDD1200
and the tables inside it are the same.
How can I query [SELECT statement] all column for myTable for the last 5 days databases?
For example, if today is 10-OCT-2013, I query all columns for myTable for these DBs:
NAME_201310101200
NAME_201310091200
NAME_201310081200
NAME_201310071200
NAME_201310061200
I try SELECT * FROM NAME_*.myTable but it oubviusly doesn't work.
How can I have a [SELECT] query DB name dynamic/built on the fly?
Thanks,