0

Looking for some help to extract a particular value from each database from the same column in Azure SQL.

Instead of running the same SELECT statement against 80+ databases, I am looking for a SQL script or if there are any in-built Stored Procedures which I can run against master database which can fetch the DatabaseName and the value I am looking for in each database.

I have tried sp_MSforeachdb, however it keeps saying:

Could not find stored procedure 'sp_MSforeachdb'.

I have tried using PowerShell (using foreach loop) which works, however would like to check if it can be done within MS SQL.

Any help is much appreciated.

EZR
  • 63
  • 6
  • 4
    Does this answer your question? [How to run the same query on all the databases on an instance?](https://stackoverflow.com/questions/18462410/how-to-run-the-same-query-on-all-the-databases-on-an-instance) – SMor May 26 '20 at 22:13
  • Thank you Dale. I will try it and will update. However, I should have mentioned that it's Azure SQL if that makes any difference, but anyways I have edited it now. – EZR May 29 '20 at 14:26

0 Answers0