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!

Re-run a query isn Query Analyser

Status
Not open for further replies.

Mirrorball

IS-IT--Management
Sep 24, 2002
2
GB
Thanks for your help on my first query. It wasn't actually a stored procedure but a script in the query analyser window. The script is to update 40 identical databases. I can use the USE command to change databases but once I've done that I want to be able to re-run the script in the window again. This scripts contains some Create Procedure commands so can't be made into a stored procedure. It also contains GO commands so I can't use the GOTO command. Is there any command which will re-execute a query in the query analyser window without pressing the execute button 40 times? If it makes any difference, I'm SQL Server 7.0.
 
Try using a CURSOR to loop through the database names and build your query within the loop. Then you can execute it for each database.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top