How to Create a SQL Job that runs across multiple databases simultaneously - SQL Server 2008 R2

Zack
Zack used Ask the Experts™
on
Hi EE,

How do I create a SQL Job that runs on multiple databases simultaneously - SQL Server 2008 R2 Below is the code I would like to run:

DELETE FROM [DATABASE_NAME].dbo.ScanRecords
       WHERE                                          
              Name = 'Empty Scan Record' AND Status = 1
Any assistance is welcome.

Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Database Expert
Awarded 2016
Top Expert 2016
Commented:
So you can create SQL jobs on respective servers with the same scheduling time with this one.

or do you want to schedule all jobs from Single Server?

Also why dont you use a SP and delete all statement at one place..if you have linked servers in place.

Sp....

DELETE FROM [DATABASE_NAME1].dbo.ScanRecords
WHERE  Name = 'Empty Scan Record' AND Status = 1

DELETE FROM [DATABASE_NAME2].dbo.ScanRecords
WHERE  Name = 'Empty Scan Record' AND Status = 1
ZackGeneral IT Goto Guy

Author

Commented:
Hi Pawan,

Cheers for the query suggestion, I just found a link that shows how to run a singular job to access multiple servers.

https://www.mssqltips.com/sqlservertip/1767/execute-sql-server-query-on-multiple-servers-at-the-same-time/

Thank you for your help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial