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

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.
ZackGeneral IT Goto GuyAsked:
Who is Participating?
 
Pawan KumarDatabase ExpertCommented:
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
0
 
ZackGeneral IT Goto GuyAuthor 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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.