May 2, 2006 at 8:28 am
I would like to do the following in SQL Server 2000:
Create a job that would execute the following command that moves a file from one server to another
copy \\server1\d$\out\file1.txt \\server2\d$\in\
however, I would like the server1 and\or server2 names to depend on a value in a table, or the value @@servername.
So, that if I run this job on another server, it would look up those names, which may be different.
Any suggestions for a simple script?
Thanks...Nali
May 2, 2006 at 8:55 am
You can use DTS and set global variable values based on the select from the table and then just use the "Execute Process Task" to run the command for copying the files over.
Another way would be to write a batch file or a command file that will retrieve these values from the table (input parameters to the file will need to be given) and then perfom the copy...all this assumes that the necessary privileges are in place.
May 2, 2006 at 9:19 am
You will have to look out for the domain account that will run the job. All copy jobs require NTFS Write permissions, so the domain accounts for Agent service account on all servers should have Write permission on all your shares.
As always, working with files I find VBscript very convenient. Create a VBscript file that uses ADO to get names from the database or uses WMI to get a local server name etc then moves files using FSO CopyFile method. See examples at:
Copying Files and Folders
Regards,Yelena Varsha
May 2, 2006 at 10:32 am
Trying using DTS with Active Scripting. Then you can have a command object but set via code effectively.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply