Rakesh.Chaudhary (7/24/2012)
I got the solution from one of my colleaguesPlease find the solution below
DECLARE @from VARCHAR(200)
DECLARE @to VARCHAR(200)
DECLARE@to_move VARCHAR(200)
DECLARE @sql VARCHAR(200)
DECLARE @sql_mov VARCHAR(200)
DECLARE @sql_del VARCHAR(200)
SELECT @to = '\\X\20120724.txt',
@from = '\\Y\20120724.txt',
@to_move = '\\Z\20120724.txt'
SET @sql = 'copy ' + @from + ' ' + @to
SET@sql_mov = 'copy ' + @from + ' ' + @to_move
SET@sql_del = 'del ' + @from
EXECUTE master..xp_cmdshell @sql
EXECUTE master..xp_cmdshell @sql_mov
EXECUTE master..xp_cmdshell @sql_del
If you're going to use xp_CmdShell for this, there is a MOVE command in DOS and in ROBOCOPY.
--Jeff Moden
Change is inevitable... Change for the better is not.