Iam totally new to SQL Administration and I am assigned with the task of running something like this.
osql -U sa -****@**** -S &&&&&\sqlexpress -d centers -i "c:\bfd\Centre script file 4003.sql" -o"c:\bfd\log280.txt"
****@**** : would be the passowrd
&&&&&\sqlexpress : Would be the server Name
Now the script is in "Centre script file 4003.sql " file.
The task i have been assigned to do is the following.
I need to run the same script in the file "Centre script file 4003.sql " for a a bunch of different remote servers.
I could do this by running the above command manually for each and every sever but I have to run this in a loop by retriving the the server names are stored in a particular table.
I found this intresting article which lets me do that using a cursor , i.e loop throught the values in the table and execute a sql command.
but iam not sure how to run a .sql file from the sql server management studio and also output it to a text file just like what the OSQL statement does above.
I woulld have to create a Stroed Procedure to accomplish this task.
Any help would be greatly aappreciated.