Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a Script after database restore

Status
Not open for further replies.

BrianC25

MIS
Jun 14, 2001
26
US
Hey Guys,

When we restore databases, a script needs to be run after the restore. I'd like to automate the running of this script so that when a database restore completes, it will kick off this particular T-SQL script. I'd imagine it can be done from isqlw by copying and pasting the script there but it would be nice to do this from Enterprise Manager. Does anyone have any ideas or is currently doing something like this?

Thanks
Brian
 
You would create a SQL Server Job for that. In Enterprise Manager drill down to Management..SQL Server Agent..Jobs. Right click on the Jobs tab and choose to create a new one.

Your job will have 2 step. first step would include the code or call to a stored procedure that restores your database.

The second step would then have your script embedded in it or you could create a stored procedure from your script and then call if from this second step.

Now you can automate the scheduling of the job as well as a few other items to control running your job.

Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top