|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, February 19, 2013 8:26 AM
Points: 7,
Visits: 204
|
|
Hi,
I would like to copy a flat file from one location to another and rename it. Can i do it in a single step coz I need to execute it as a daily job. does xcopy support this.
Thanks in advance.
Madduri
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Tuesday, March 26, 2013 7:19 AM
Points: 1,279,
Visits: 2,191
|
|
try "copy c:\myfolder\myfile.txt d:\yourfolder\yourfile.txt".
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, February 19, 2013 8:26 AM
Points: 7,
Visits: 204
|
|
Thank you for your reply. I did it using ssis.
Thanks, Madduri
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Wednesday, April 17, 2013 3:39 AM
Points: 1,768,
Visits: 1,312
|
|
SSIS might be expensive. Here is the simple way; create job and write following T-SQL command:
xp_cmdshell "copy c:\myfolder\myfile.txt d:\yourfolder\yourfile.txt"
--------------------------------------------------- "Thare are only 10 types of people in the world: Those who understand binary, and those who don't."
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Sunday, October 21, 2012 8:59 PM
Points: 421,
Visits: 362
|
|
You can use CmdExec method (Using operating system command) also to run the command. To Use the extended stored procedure xp_cmdShell, it needs to be enabled. By default it is disabled due to security concerns.
The Job Step will be some thing like this: EXEC @ReturnCode = msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'copy file', @step_id=1, @cmdexec_success_code=0, @on_success_action=1, @on_success_step_id=0, @on_fail_action=2, @on_fail_step_id=0, @retry_attempts=0, @retry_interval=0, @os_run_priority=0, @subsystem=N'CmdExec', @command=N'ccopy c:\myfolder\myfile.txt d:\yourfolder\yourfile.txt', @flags=0
Cheers, Prithiviraj Kulasingham
http://preethiviraj.blogspot.com/
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, May 01, 2008 10:14 AM
Points: 1,
Visits: 5
|
|
| How did you do it using SISS? I have been trying to figure this out and I am fine with the fact that it might be expensive, I am trying to do this with a very small data set.
|
|
|
|