On SQL Server 2012 (not express edition) I'd like to schedule the execution of a stored procedure every hour.

On the same server I have lot of databases with the same structure, and I'm constantly adding new db.

How can I schedule the execution of the same stored procedure on all the databases (if this exists in the database)?


Use the better version of the undocumented sp_MSForEachDB to iterate through the databases in a SQL Server Agent job.

Or simply use a WHILE loop yourself on sys.database entries if you have a naming pattern.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy