Sql Server loop through databases

How can I run the same command on all SQL Server databases without cursors The stored procedure sp_MSforeachdb allows us to iterate through each database in a SQL Server instance without a loop statement. It’s usage is similar than sp_MSforeachtable; simply execute the stored procedure, passing it the command that you’d like to execute as […]