January 28, 2008 at 12:55 pm
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
January 28, 2008 at 6:15 pm
try "copy c:\myfolder\myfile.txt d:\yourfolder\yourfile.txt".
January 30, 2008 at 11:17 am
Thank you for your reply. I did it using ssis.
Thanks, Madduri
January 31, 2008 at 12:48 am
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."
January 31, 2008 at 4:19 am
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/
March 17, 2008 at 2:05 pm
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.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply