What I'd like to do is create a report that will pull data from 6 databases, where the schema is the same for all 6,
and consolidate the data into the one report.
But how can I do this without being prompted? Would I write the query to use a variable and incorporate a loop?
For example, would this work (this is pseudo code):
for each db in "db1, db2, db3, db4, db5, db6"
SELECT * FROM @db.dbo.mytable
end
Or is there a better way to do this?