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.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 SQLCMD

Author  Topic 

zaty2405
Yak Posting Veteran

58 Posts

Posted - 2010-03-25 : 19:59:58
Hi,

I need to populate scripts from Master server to other servers ( > 100 servers)

The format of the scripts : SQLCMD -E -S <destination server> -i \\<MasterServer>\e$\XXXXX.sql -o E:\xxxx.out

How do I schedule these scripts using SSMS on the MasterServer ?

I found this : http://msdn.microsoft.com/en-us/library/ms190264(SQL.90).aspx but in my case I have thousands of lines of SQLCMD ...

I want to know how can i put all the scripts in one Job step only.

Appreciate helps on this

Thank you

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-25 : 20:14:09
put your script in a batch file and schedule in SQL Agent using the Operating System (cmdexec) type


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

zaty2405
Yak Posting Veteran

58 Posts

Posted - 2010-03-25 : 23:45:56
Thank KH.

Do you have a step how to do this?

How do i call the script from the SSMS job step?

Thanks
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-03-25 : 23:54:57
it is just a simple batch file. Place all the SQLCMD in the batch file

in SSMS, go to SQL Agent and add task specify Operating System (cmdexec) type and then specify the path & name of the batch file that you have created


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -