Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Kowalski
Starting Member
3 Posts |
Posted - 2008-12-11 : 06:50:28
|
Hi, I have a sql file that needs run on over a hundred different machines.At the moment my only options on getting this script ran on each machines db is to log on to the PC and execute either through quary analyser or command line OSQL, both options are rather time consuming so my attention has now shifted to a batch file (which i have limited experience of)Now my plan was to dump the required SQL file in say C:\temp on the remote machine, then execute the batch on my machine which would then map to the remote machine and execute the script via OSQL, easier said than done sadly.Here is the script I have so far, as I said, im fairly new to this so go slow Batch:ping %1 -n 5c:cd cd C:\rootREM Do the worknet use b: \\%1\c$ /user:user passwordb:cd osql -Usa -Ppassword -s(local) -Dsitedb -ic:\temp\333283.sqlc:C:\root\sleep 2net use b: /delAs you can tell from the first line etc, IP adds are fed into a params text file and it carrys on dependent on how many IPs are in the file etc.Any help greatly appreciated.Cheers |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-12-11 : 07:34:52
|
| moved from script library.___________________________________________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.1 out! |
 |
|
|
darkdusky
Aged Yak Warrior
591 Posts |
Posted - 2008-12-17 : 07:35:18
|
| Why not just loop through each server using a batch file running on your machine?osql -Usa -Ppassword -sServerName -Dsitedb -ic:\temp\333283.sql |
 |
|
|
|
|
|