I have multiple identical databases on sql server 2008 R2 Server. Identical means every database has different name but the structure and tables are all same. Twice a month, I've to generate a report, and to generate that report i select each database and run the below script on sql server to findout the activities on those database tables one by one. for example:
Select MAX(DateOfLastUpdate) AS lastUpdate1
Select MAX(DateOfLastUpdate) AS lastUpdate2
Select MAX(DateOfLastUpdate) as lastUpdate3
after that, i write down the results in a sheet and then create the report on excel sheet with database's name. is there a way, i can run the script just one time, not to select different names of databases and generate the report of all the databases at one time.